diff --git a/library/think/log/driver/sae.php b/library/think/log/driver/sae.php index 17f4b7fe..79b278fa 100644 --- a/library/think/log/driver/sae.php +++ b/library/think/log/driver/sae.php @@ -60,7 +60,10 @@ class Sae $logstr = "[{$now}] {$_SERVER['SERVER_ADDR']} {$_SERVER['REMOTE_ADDR']} {$_SERVER['REQUEST_URI']}\r\n{$info}\r\n"; if (is_null($is_debug)) { - preg_replace('@(\w+)\=([^;]*)@e', '$appSettings[\'\\1\']="\\2";', $_SERVER['HTTP_APPCOOKIE']); + $appSettings=[]; + preg_replace_callback('@(\w+)\=([^;]*)@', function($match)use(&$appSettings){ + $appSettings[$match['1']]=$match['2']; + }, $_SERVER['HTTP_APPCOOKIE']); $is_debug = in_array($_SERVER['HTTP_APPVERSION'], explode(',', $appSettings['debug'])) ? true : false; } if ($is_debug) { diff --git a/mode/sae.php b/mode/sae.php index 5407f904..3ca00794 100644 --- a/mode/sae.php +++ b/mode/sae.php @@ -12,10 +12,11 @@ /** * ThinkPHP SAE应用模式定义文件 */ -$st = new SaeStorage(); + +$convention_config = include THINK_PATH . 'convention' . EXT; return [ // 配置文件 - 'config' => [ + 'config' => array_merge($convention_config,[ /* 数据库设置 */ 'database' => [ // 数据库类型 @@ -48,28 +49,55 @@ return [ // 指定从服务器序号 'slave_no' => '', ], - 'log' => [ + 'log' => [ 'type' => 'Sae', ], - 'cache' => [ - 'type' => 'Sae', + 'cache' => [ + 'type' => 'Sae', + 'path' => CACHE_PATH, + 'prefix' => '', + 'expire' => 0, ], 'file_upload_type' => 'Sae', - 'template' => [ - 'compile_type' => 'Sae', + 'template' => [ + 'compile_type' => 'Sae', ], - - ], + 'compile_type' => 'Sae', + ]), // 别名定义 'alias' => [ - 'think\Log' => CORE_PATH . 'log' . EXT, + + + 'think\App' => CORE_PATH . 'app' . EXT, + 'think\Cache' => CORE_PATH . 'cache' . EXT, + 'think\Config' => CORE_PATH . 'config' . EXT, + 'think\Controller' => CORE_PATH . 'controller' . EXT, + 'think\Cookie' => CORE_PATH . 'cookie' . EXT, + 'think\Create' => CORE_PATH . 'create' . EXT, + 'think\Db' => CORE_PATH . 'db' . EXT, + 'think\Debug' => CORE_PATH . 'debug' . EXT, + 'think\Error' => CORE_PATH . 'error' . EXT, + 'think\Exception' => CORE_PATH . 'exception' . EXT, + 'think\Hook' => CORE_PATH . 'hook' . EXT, + 'think\Input' => CORE_PATH . 'input' . EXT, + 'think\Lang' => CORE_PATH . 'lang' . EXT, + 'think\Log' => CORE_PATH . 'log' . EXT, + 'think\Model' => CORE_PATH . 'model' . EXT, + 'think\Response' => CORE_PATH . 'response' . EXT, + 'think\Route' => CORE_PATH . 'route' . EXT, + 'think\Session' => CORE_PATH . 'session' . EXT, + 'think\Template' => CORE_PATH . 'template' . EXT, + 'think\Url' => CORE_PATH . 'url' . EXT, + 'think\View' => CORE_PATH . 'view' . EXT, + 'think\db\Driver' => CORE_PATH . 'db' . DS . 'driver' . EXT, + 'think\view\driver\Think' => CORE_PATH . 'view' . DS . 'driver' . DS . 'think' . EXT, + 'think\template\driver\File' => CORE_PATH . 'template' . DS . 'driver' . DS . 'file' . EXT, + 'think\log\driver\File' => CORE_PATH . 'log' . DS . 'driver' . DS . 'file' . EXT, + 'think\cache\driver\File' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'file' . EXT, + 'think\Slog' => CORE_PATH . 'slog'.EXT, + 'think\log\driver\Sae' => CORE_PATH . 'log' . DS . 'driver' . DS . 'sae' . EXT, - 'think\Exception' => CORE_PATH . 'exception' . EXT, - 'think\Model' => CORE_PATH . 'model' . EXT, - 'think\Db' => CORE_PATH . 'db' . EXT, - 'think\Template' => CORE_PATH . 'template' . EXT, - 'think\Cache' => CORE_PATH . 'cache' . EXT, 'think\cache\driver\Sae' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'sae' . EXT, 'think\template\driver\Sae' => CORE_PATH . 'template' . DS . 'driver' . DS . 'sae' . EXT, ],