mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-03-07 15:16:40 +08:00
Set UTF-8 encoding for error messages
This commit is contained in:
parent
62af291091
commit
6448b3bbab
@ -53,7 +53,10 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
if (class_exists($className)) {
|
if (class_exists($className)) {
|
||||||
$this->app->singleton('cipher', $className);
|
$this->app->singleton('cipher', $className);
|
||||||
} else {
|
} else {
|
||||||
exit(sprintf("No such encrypt method: [%s], please check your .env configuration.", config('secure.cipher')));
|
die_with_utf8_encoding(sprintf(
|
||||||
|
'[Error] Unsupported encryption method: < %1$s >, please check your .env configuration <br>'.
|
||||||
|
'[错误] 不支持的密码加密方式 < %1$s >,请检查你的 .env 配置文件'
|
||||||
|
, config('secure.cipher')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->singleton('users', \App\Services\Repositories\UserRepository::class);
|
$this->app->singleton('users', \App\Services\Repositories\UserRepository::class);
|
||||||
|
@ -406,7 +406,7 @@ if (! function_exists('runtime_check')) {
|
|||||||
{
|
{
|
||||||
foreach ($requirements['extensions'] as $extension) {
|
foreach ($requirements['extensions'] as $extension) {
|
||||||
if (! extension_loaded($extension)) {
|
if (! extension_loaded($extension)) {
|
||||||
exit(
|
die_with_utf8_encoding(
|
||||||
"[Error] You have not installed the $extension extension <br>".
|
"[Error] You have not installed the $extension extension <br>".
|
||||||
"[错误] 你尚未安装 $extension 扩展!安装方法请自行搜索,蟹蟹。"
|
"[错误] 你尚未安装 $extension 扩展!安装方法请自行搜索,蟹蟹。"
|
||||||
);
|
);
|
||||||
@ -416,16 +416,32 @@ if (! function_exists('runtime_check')) {
|
|||||||
foreach (array_get($requirements, 'write_permission', []) as $dir) {
|
foreach (array_get($requirements, 'write_permission', []) as $dir) {
|
||||||
$realPath = realpath(__DIR__."/../$dir");
|
$realPath = realpath(__DIR__."/../$dir");
|
||||||
|
|
||||||
|
if (! file_exists($realPath)) {
|
||||||
|
die_with_utf8_encoding(
|
||||||
|
"[Error] The directory < $dir > does not exist <br>".
|
||||||
|
"[错误] 目录 < $dir > 不存在,请在程序根目录下手动创建"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (! is_writable($realPath)) {
|
if (! is_writable($realPath)) {
|
||||||
exit(
|
die_with_utf8_encoding(
|
||||||
"[Error] The program lacks write permission to directory $dir <br>".
|
"[Error] The program lacks write permission to directory < $dir > <br>".
|
||||||
"[错误] 程序缺少对 $dir 目录的写权限或目录不存在,请手动授权/创建"
|
"[错误] 程序缺少对 < $dir > 目录的写权限,请手动授权"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! function_exists('die_with_utf8_encoding')) {
|
||||||
|
|
||||||
|
function die_with_utf8_encoding($error)
|
||||||
|
{
|
||||||
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
|
exit($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! function_exists('get_db_type')) {
|
if (! function_exists('get_db_type')) {
|
||||||
|
|
||||||
function get_db_type($type = null)
|
function get_db_type($type = null)
|
||||||
|
@ -17,9 +17,10 @@ define('LARAVEL_START', microtime(true));
|
|||||||
if (file_exists($autoload = __DIR__.'/../vendor/autoload.php')) {
|
if (file_exists($autoload = __DIR__.'/../vendor/autoload.php')) {
|
||||||
require $autoload;
|
require $autoload;
|
||||||
} else {
|
} else {
|
||||||
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
exit(
|
exit(
|
||||||
"No vendor folder found. Have you installed the dependencies with composer? <br>".
|
"[Error] No vendor folder found. Have you installed the dependencies with composer? <br>".
|
||||||
"根目录下未发现 vendor 文件夹,请参照安装说明使用 composer 安装依赖库。"
|
"[错误] 根目录下未发现 vendor 文件夹,请使用 composer 安装依赖库。详情请阅读 http://t.cn/REyMUqA"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,9 +11,10 @@
|
|||||||
|
|
||||||
// Check PHP version
|
// Check PHP version
|
||||||
if (version_compare(PHP_VERSION, '5.5.9', '<')) {
|
if (version_compare(PHP_VERSION, '5.5.9', '<')) {
|
||||||
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
exit(
|
exit(
|
||||||
'[Error] Blessing Skin Server needs PHP version >= 5.5.9, you are now using '.PHP_VERSION.'<br>'.
|
'[Error] Blessing Skin requires PHP version >= 5.5.9, you are now using '.PHP_VERSION.'<br>'.
|
||||||
'[错误] 你的 PHP 版本过低('.PHP_VERSION.'),Blessing Skin Server 要求至少为 5.5.9'
|
'[错误] 你的 PHP 版本过低('.PHP_VERSION.'),Blessing Skin 要求至少为 5.5.9'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user