diff --git a/base.php b/base.php index 2ce1632a..777e3a44 100644 --- a/base.php +++ b/base.php @@ -230,7 +230,7 @@ function U($url, $vars = '', $suffix = true, $domain = false) function session($name, $value = '') { if (is_array($name)) { -// 初始化 + // 初始化 think\Session::init($name); } elseif (is_null($name)) { // 清除 @@ -250,7 +250,7 @@ function session($name, $value = '') function cookie($name, $value = '') { if (is_array($name)) { -// 初始化 + // 初始化 think\Cookie::init($name); } elseif (is_null($name)) { // 清除 @@ -278,14 +278,14 @@ function S($name, $value = '', $options = null) { static $cache = null; if (is_array($options)) { -// 缓存操作的同时初始化 + // 缓存操作的同时初始化 $cache = think\Cache::connect($options); } elseif (is_array($name)) { // 缓存初始化 $cache = think\Cache::connect($name); return $cache; } elseif (is_null($cache)) { -// 自动初始化 + // 自动初始化 $cache = think\Cache::connect(); } if ('' === $value) { diff --git a/library/think/config.php b/library/think/config.php index 8c0b7ccf..0e14da7f 100644 --- a/library/think/config.php +++ b/library/think/config.php @@ -13,8 +13,10 @@ namespace think; class Config { - private static $config = []; // 配置参数 - private static $range = '_sys_'; // 参数作用域 + // 配置参数 + private static $config = []; + // 参数作用域 + private static $range = '_sys_'; // 设定配置参数的作用域 public static function range($range) diff --git a/library/think/cookie.php b/library/think/cookie.php index 7e0efeef..879e03f1 100644 --- a/library/think/cookie.php +++ b/library/think/cookie.php @@ -15,12 +15,18 @@ class Cookie { protected static $config = [ - 'prefix' => '', // cookie 名称前缀 - 'expire' => 0, // cookie 保存时间 - 'path' => '/', // cookie 保存路径 - 'domain' => '', // cookie 有效域名 - 'secure' => false, // cookie 启用安全传输 - 'httponly' => '', // httponly设置 + // cookie 名称前缀 + 'prefix' => '', + // cookie 保存时间 + 'expire' => 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => '', ]; /** diff --git a/library/think/db.php b/library/think/db.php index d65d2e29..e2f7dbd1 100644 --- a/library/think/db.php +++ b/library/think/db.php @@ -16,9 +16,10 @@ namespace think; */ class Db { - - private static $instance = []; // 数据库连接实例 - private static $_instance = null; // 当前数据库连接实例 + // 数据库连接实例 + private static $instance = []; + // 当前数据库连接实例 + private static $_instance = null; /** * 取得数据库类实例 diff --git a/library/think/exception.php b/library/think/exception.php index 6e97d08b..54643a62 100644 --- a/library/think/exception.php +++ b/library/think/exception.php @@ -11,6 +11,5 @@ namespace think; -class Exception extends \Exception { - -} +class Exception extends \Exception +{} diff --git a/library/think/lang.php b/library/think/lang.php index d06b9e64..4a1e04e4 100644 --- a/library/think/lang.php +++ b/library/think/lang.php @@ -13,8 +13,10 @@ namespace think; class Lang { - private static $lang = []; // 语言参数 - private static $range = '_sys_'; // 作用域 + // 语言参数 + private static $lang = []; + // 作用域 + private static $range = '_sys_'; // 设定语言参数的作用域 public static function range($range) diff --git a/library/think/model.php b/library/think/model.php index e42279ed..dc279bfe 100644 --- a/library/think/model.php +++ b/library/think/model.php @@ -18,7 +18,7 @@ class Model const MODEL_UPDATE = 2; // 更新 const MODEL_BOTH = 3; // 全部 // 当前数据库操作对象 - protected $db = null; + protected $db = null; // 数据库对象池 private $_db = []; // 主键名称 diff --git a/library/think/template.php b/library/think/template.php index 7b8dfeda..1e9fa0cb 100644 --- a/library/think/template.php +++ b/library/think/template.php @@ -18,8 +18,10 @@ namespace think; */ class Template { - protected $data = []; // 模板变量 - protected $config = [ // 引擎配置 + // 模板变量 + protected $data = []; + // 引擎配置 + protected $config = [ 'tpl_path' => VIEW_PATH, // 模板路径 'tpl_suffix' => '.html', // 默认模板文件后缀 'cache_suffix' => '.php', // 默认模板缓存后缀 diff --git a/library/think/view.php b/library/think/view.php index 120b3915..5328ca2c 100644 --- a/library/think/view.php +++ b/library/think/view.php @@ -13,10 +13,14 @@ namespace think; class View { - protected $engine = null; // 模板引擎实例 - protected $theme = ''; // 模板主题名称 - protected $data = []; // 模板变量 - protected $config = [ // 视图参数 + // 模板引擎实例 + protected $engine = null; + // 模板主题名称 + protected $theme = ''; + // 模板变量 + protected $data = []; + // 视图参数 + protected $config = [ 'theme_on' => false, 'auto_detect_theme' => false, 'var_theme' => 't', diff --git a/start.php b/start.php index 0dffb123..7d0ce91a 100644 --- a/start.php +++ b/start.php @@ -20,9 +20,9 @@ require CORE_PATH . 'loader.php'; Loader::register(); // 注册错误和异常处理机制 -register_shutdown_function(['think\error', 'appShutdown']); -set_error_handler(['think\error', 'appError']); -set_exception_handler(['think\error', 'appException']); +register_shutdown_function(['think\Error', 'appShutdown']); +set_error_handler(['think\Error', 'appError']); +set_exception_handler(['think\Error', 'appException']); // 加载模式定义文件 $mode = require MODE_PATH . APP_MODE . EXT;