完善SAE模式

This commit is contained in:
upfy@qq.com
2015-12-25 23:18:52 +08:00
parent 736a451a44
commit 589f4c5353
2 changed files with 47 additions and 16 deletions

View File

@@ -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) {

View File

@@ -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,
],