diff --git a/Library/Org/README.md b/Library/Org/README.md new file mode 100644 index 00000000..f7e2b587 --- /dev/null +++ b/Library/Org/README.md @@ -0,0 +1 @@ +ThinkPHP 扩展类库目录 \ No newline at end of file diff --git a/Think/App.php b/Think/App.php index 413a37b4..8821441f 100644 --- a/Think/App.php +++ b/Think/App.php @@ -63,7 +63,7 @@ class App { $action = ACTION_NAME.$config['action_suffix']; try{ // 操作方法开始监听 - $call = array($instance,$action); + $call = [$instance,$action]; Tag::listen('action_begin',$call); if(!preg_match('/^[A-Za-z](\w)*$/',$action)){ // 非法操作 @@ -109,7 +109,7 @@ class App { // 操作不存在 if(method_exists($instance,'_empty')) { $method = new \ReflectionMethod($instance,'_empty'); - $method->invokeArgs($instance,array($action,'')); + $method->invokeArgs($instance,[$action,'']); }else{ E('[ '.(new \ReflectionClass($instance))->getName().':'.$action.' ] not exists ',404); } diff --git a/Think/Behavior/ContentReplace.php b/Think/Behavior/ContentReplace.php index 6c7a9639..09bd1e05 100644 --- a/Think/Behavior/ContentReplace.php +++ b/Think/Behavior/ContentReplace.php @@ -44,7 +44,7 @@ class ContentReplace { define('ACTION_URL', CONTROLLER_URL.'/'.ACTION_NAME); // 系统默认的特殊变量替换 - $replace = array( + $replace = [ '__ROOT__' => ROOT_URL, // 当前网站地址 '__APP__' => MODULE_URL, // 当前项目地址 '__CONTROLL__' => CONTROLLER_URL, // 当前操作地址 @@ -52,7 +52,7 @@ class ContentReplace { '__ACTION__' => ACTION_URL, // 当前操作地址 '__SELF__' => $_SERVER['PHP_SELF'], // 当前页面地址 '__PUBLIC__' => ROOT_URL.'/Public',// 站点公共目录 - ); + ]; // 允许用户自定义模板的字符串替换 if(is_array(Config::get('tmpl_parse_string')) ) $replace = array_merge($replace,Config::get('tmpl_parse_string')); diff --git a/Think/Behavior/ReadHtmlCache.php b/Think/Behavior/ReadHtmlCache.php index 086a3564..b830183f 100644 --- a/Think/Behavior/ReadHtmlCache.php +++ b/Think/Behavior/ReadHtmlCache.php @@ -17,12 +17,12 @@ * @author liu21st */ class ReadHtmlCacheBehavior { - protected $options = array( + protected $options = [ 'HTML_CACHE_ON' => false, 'HTML_CACHE_TIME' => 60, 'HTML_CACHE_RULES' => [], 'HTML_FILE_SUFFIX' => '.html', - ); + ]; // 行为扩展的执行入口必须是run public function run(&$params){ @@ -72,8 +72,8 @@ class ReadHtmlCacheBehavior { $rule = preg_replace('/{(\w+)}/e',"\$_GET['\\1']",$rule); // 特殊系统变量 $rule = str_ireplace( - array('{:app}','{:module}','{:action}','{:group}'), - array(APP_NAME,MODULE_NAME,ACTION_NAME,defined('GROUP_NAME')?GROUP_NAME:''), + ['{:app}','{:module}','{:action}','{:group}'], + [APP_NAME,MODULE_NAME,ACTION_NAME,defined('GROUP_NAME')?GROUP_NAME:''], $rule); // {|FUN} 单独使用函数 $rule = preg_replace('/{|(\w+)}/e',"\\1()",$rule); diff --git a/Think/Behavior/ShowPageTrace.php b/Think/Behavior/ShowPageTrace.php index c0b65621..e2551add 100644 --- a/Think/Behavior/ShowPageTrace.php +++ b/Think/Behavior/ShowPageTrace.php @@ -42,7 +42,7 @@ class ShowPageTrace { } $trace = []; Debug::remark('START',$GLOBALS['startTime']); - $base = array( + $base = [ '请求信息' => date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.$_SERVER['PHP_SELF'], '运行时间' => Debug::getUseTime('START','END',6).'s', '内存开销' => MEMORY_LIMIT_ON?G('START','END','m').'b':'不支持', @@ -50,7 +50,7 @@ class ShowPageTrace { '文件加载' => count($files), '缓存信息' => N('cache_read').' gets '.N('cache_write').' writes ', '配置加载' => count(Config::get()), - ); + ]; // 读取项目定义的Trace文件 $traceFile = MODULE_PATH.'trace.php'; if(is_file($traceFile)) { diff --git a/Think/Behavior/TokenBuild.php b/Think/Behavior/TokenBuild.php index cdce04b9..dfacb1aa 100644 --- a/Think/Behavior/TokenBuild.php +++ b/Think/Behavior/TokenBuild.php @@ -19,12 +19,12 @@ defined('THINK_PATH') or exit(); */ class TokenBuildBehavior extends Behavior { // 行为参数定义 - protected $options = array( + protected $options = [ 'TOKEN_ON' => false, // 开启令牌验证 'TOKEN_NAME' => '__hash__', // 令牌验证的表单隐藏字段名称 'TOKEN_TYPE' => 'md5', // 令牌验证哈希规则 'TOKEN_RESET' => true, // 令牌错误后是否重置 - ); + ]; public function run(&$content){ if(C('TOKEN_ON')) { diff --git a/Think/Cache/Driver/Apc.php b/Think/Cache/Driver/Apc.php index d85feb7e..a770cef8 100644 --- a/Think/Cache/Driver/Apc.php +++ b/Think/Cache/Driver/Apc.php @@ -17,11 +17,11 @@ namespace Think\Cache\Driver; */ class Apc { - protected $options = array( + protected $options = [ 'expire' => 0, 'prefix' => '', 'length' => 0, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Db.php b/Think/Cache/Driver/Db.php index 38ccbcdf..42af2cd4 100644 --- a/Think/Cache/Driver/Db.php +++ b/Think/Cache/Driver/Db.php @@ -23,13 +23,13 @@ namespace Think\Cache\Driver; class Db { protected $handler = null; - protected $options = array( + protected $options = [ 'db' => '', 'table' => '', 'prefix' => '', 'expire' => 0, 'length' => 0, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Eaccelerator.php b/Think/Cache/Driver/Eaccelerator.php index 0bbf6c98..4c1758bf 100644 --- a/Think/Cache/Driver/Eaccelerator.php +++ b/Think/Cache/Driver/Eaccelerator.php @@ -15,11 +15,11 @@ namespace Think\Cache\Driver; */ class Eaccelerator { - protected $options = array( + protected $options = [ 'prefix' => '', 'expire' => 0, 'length' => 0, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/File.php b/Think/Cache/Driver/File.php index b0af01b8..01407ea1 100644 --- a/Think/Cache/Driver/File.php +++ b/Think/Cache/Driver/File.php @@ -9,13 +9,14 @@ // | Author: liu21st // +---------------------------------------------------------------------- namespace Think\Cache\Driver; + /** * 文件类型缓存类 * @author liu21st */ class File { - protected $options = array( + protected $options = [ 'expire' => 0, 'cache_subdir' => false, 'path_level' => 1, @@ -23,7 +24,7 @@ class File { 'length' => 0, 'temp' => '', 'data_compress' => false, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Memcache.php b/Think/Cache/Driver/Memcache.php index ac773315..fc5bc514 100644 --- a/Think/Cache/Driver/Memcache.php +++ b/Think/Cache/Driver/Memcache.php @@ -15,14 +15,14 @@ namespace Think\Cache\Driver; */ class Memcache { protected $handler = null; - protected $options = array( + protected $options = [ 'host' => '127.0.0.1', 'port' => 11211, 'expire' => 0, 'timeout' => false, 'persistent' => false, 'length' => 0, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Redis.php b/Think/Cache/Driver/Redis.php index 39c5f974..ed2307fa 100644 --- a/Think/Cache/Driver/Redis.php +++ b/Think/Cache/Driver/Redis.php @@ -16,14 +16,14 @@ namespace Think\Cache\Driver; */ class Redis { protected $handler = null; - protected $options = array( + protected $options = [ 'host' => '127.0.0.1', 'port' => 6379, 'timeout' => false, 'expire' => 0, 'persistent' => false, 'length' => 0, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Secache.php b/Think/Cache/Driver/Secache.php index 126a501e..c4c97503 100644 --- a/Think/Cache/Driver/Secache.php +++ b/Think/Cache/Driver/Secache.php @@ -16,13 +16,13 @@ namespace Think\Cache\Driver; class Secache { protected $handler = null; - protected $options = array( + protected $options = [ 'project' => '', 'temp' => '', 'expire' => 0, 'prefix' => '', 'length' => 0, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Simple.php b/Think/Cache/Driver/Simple.php index ec95f548..50246e5e 100644 --- a/Think/Cache/Driver/Simple.php +++ b/Think/Cache/Driver/Simple.php @@ -15,10 +15,10 @@ namespace Think\Cache\Driver; */ class Simple { - protected $options = array( + protected $options = [ 'prefix' => '', 'temp' => '', - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Sqlite.php b/Think/Cache/Driver/Sqlite.php index 8914fabd..9b9d5495 100644 --- a/Think/Cache/Driver/Sqlite.php +++ b/Think/Cache/Driver/Sqlite.php @@ -15,14 +15,14 @@ namespace Think\Cache\Driver; */ class Sqlite { - protected $options = array( + protected $options = [ 'db' => ':memory:', 'table' => 'sharedmemory', 'prefix' => '', 'expire' => 0, 'length' => 0, 'persistent' => false, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Wincache.php b/Think/Cache/Driver/Wincache.php index 0d8178c7..b7b89b7c 100644 --- a/Think/Cache/Driver/Wincache.php +++ b/Think/Cache/Driver/Wincache.php @@ -15,11 +15,11 @@ namespace Think\Cache\Driver; */ class Wincache { - protected $options = array( + protected $options = [ 'prefix' => '', 'expire' => 0, 'length' => 0, - ); + ]; /** * 架构函数 diff --git a/Think/Cache/Driver/Xcache.php b/Think/Cache/Driver/Xcache.php index 934fbeb1..3a112d8a 100644 --- a/Think/Cache/Driver/Xcache.php +++ b/Think/Cache/Driver/Xcache.php @@ -15,11 +15,11 @@ namespace Think\Cache\Driver; */ class Xcache { - protected $options = array( + protected $options = [ 'prefix' => '', 'expire' => 0, 'length' => 0, - ); + ]; /** * 架构函数 diff --git a/Think/Controller.php b/Think/Controller.php index ea1b2156..bdfc1690 100644 --- a/Think/Controller.php +++ b/Think/Controller.php @@ -15,15 +15,15 @@ class Controller { public function __construct(){ - $config['template_options'] = array( + $config['template_options'] = [ 'tpl_path' => MODULE_PATH.'view/', 'cache_path' => MODULE_PATH.'cache/', 'compile_type' => 'File', 'taglib_build_in' => 'cx', - 'cache_options' => array( + 'cache_options' => [ 'temp' => APP_PATH.'runtime/temp/', - ), - ); + ], + ]; $config['http_content_type'] = 'text/html'; $config['http_cache_control'] = 'private'; $config['http_charset'] = 'utf-8'; diff --git a/Think/Cookie.php b/Think/Cookie.php index 1520e7f4..c556754f 100644 --- a/Think/Cookie.php +++ b/Think/Cookie.php @@ -52,7 +52,7 @@ class Cookie { // 参数设置(会覆盖黙认设置) if (!is_null($option)) { if (is_numeric($option)) - $option = array('expire' => $option); + $option = ['expire' => $option]; elseif (is_string($option)) parse_str($option, $option); $config = array_merge(self::$config, array_change_key_case($option)); diff --git a/Think/Db/Driver/Mysql.php b/Think/Db/Driver/Mysql.php index 79279b8e..d4f36ebe 100644 --- a/Think/Db/Driver/Mysql.php +++ b/Think/Db/Driver/Mysql.php @@ -29,14 +29,14 @@ class Mysql extends Driver{ $info = []; if($result) { foreach ($result as $key => $val) { - $info[$val['field']] = array( + $info[$val['field']] = [ 'name' => $val['field'], 'type' => $val['type'], 'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes 'default' => $val['default'], 'primary' => (strtolower($val['key']) == 'pri'), 'autoinc' => (strtolower($val['extra']) == 'auto_increment'), - ); + ]; } } return $info; diff --git a/Think/Db/Driver/Oracle.php b/Think/Db/Driver/Oracle.php index d04e1e94..29b9e0fd 100644 --- a/Think/Db/Driver/Oracle.php +++ b/Think/Db/Driver/Oracle.php @@ -72,14 +72,14 @@ class Oracle extends Driver{ $info = []; if($result) { foreach ($result as $key => $val) { - $info[strtolower($val['column_name'])] = array( + $info[strtolower($val['column_name'])] = [ 'name' => strtolower($val['column_name']), 'type' => strtolower($val['data_type']), 'notnull' => $val['notnull'], 'default' => $val['data_default'], 'primary' => $val['pk'], 'autoinc' => $val['pk'], - ); + ]; } } return $info; diff --git a/Think/Db/Driver/Pgsql.php b/Think/Db/Driver/Pgsql.php index f46e75a0..61d5c7f3 100644 --- a/Think/Db/Driver/Pgsql.php +++ b/Think/Db/Driver/Pgsql.php @@ -29,14 +29,14 @@ class Pgsql extends Driver{ $info = []; if($result){ foreach ($result as $key => $val) { - $info[$val['field']] = array( + $info[$val['field']] = [ 'name' => $val['field'], 'type' => $val['type'], 'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes 'default' => $val['default'], 'primary' => (strtolower($val['key']) == 'pri'), 'autoinc' => (strtolower($val['extra']) == 'auto_increment'), - ); + ]; } } return $info; diff --git a/Think/Db/Driver/Sqlite.php b/Think/Db/Driver/Sqlite.php index 66cf3a86..0b9f0e1f 100644 --- a/Think/Db/Driver/Sqlite.php +++ b/Think/Db/Driver/Sqlite.php @@ -29,14 +29,14 @@ class Sqlite extends Driver { $info = []; if($result){ foreach ($result as $key => $val) { - $info[$val['field']] = array( + $info[$val['field']] = [ 'name' => $val['field'], 'type' => $val['type'], 'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes 'default' => $val['default'], 'primary' => (strtolower($val['dey']) == 'pri'), 'autoinc' => (strtolower($val['extra']) == 'auto_increment'), - ); + ]; } } return $info; diff --git a/Think/Db/Driver/Sqlsrv.php b/Think/Db/Driver/Sqlsrv.php index 85f8c220..504ac8b2 100644 --- a/Think/Db/Driver/Sqlsrv.php +++ b/Think/Db/Driver/Sqlsrv.php @@ -37,14 +37,14 @@ class Sqlsrv extends Driver{ $info = []; if($result) { foreach ($result as $key => $val) { - $info[$val['column_name']] = array( + $info[$val['column_name']] = [ 'name' => $val['column_name'], 'type' => $val['data_type'], 'notnull' => (bool) ($val['is_nullable'] === ''), // not null is empty, null is yes 'default' => $val['column_default'], 'primary' => false, 'autoinc' => false, - ); + ]; } } return $info; diff --git a/Think/Debug.php b/Think/Debug.php index 7f2c3f3f..1d3c8403 100644 --- a/Think/Debug.php +++ b/Think/Debug.php @@ -53,7 +53,7 @@ class Debug { if(!isset(self::$_mem['mem'][$end])) self::$_mem['mem'][$end] = memory_get_usage(); $size = self::$_mem['mem'][$end]-self::$_mem['mem'][$start]; - $a = array('B', 'KB', 'MB', 'GB', 'TB'); + $a = ['B', 'KB', 'MB', 'GB', 'TB']; $pos = 0; while ($size >= 1024) { $size /= 1024; @@ -72,7 +72,7 @@ class Debug { static public function getMemPeak($start,$end,$dec=2) { if(!isset(self::$_mem['peak'][$end])) self::$_mem['peak'][$end] = function_exists('memory_get_peak_usage')?memory_get_peak_usage():memory_get_usage(); $size = self::$_mem['peak'][$end]-self::$_mem['peak'][$start]; - $a = array('B', 'KB', 'MB', 'GB', 'TB'); + $a = ['B', 'KB', 'MB', 'GB', 'TB']; $pos = 0; while ($size >= 1024) { $size /= 1024; diff --git a/Think/Filter.php b/Think/Filter.php index 75c1ebaf..55e5d7ee 100644 --- a/Think/Filter.php +++ b/Think/Filter.php @@ -12,10 +12,10 @@ namespace Think; class Filter { //html标签设置 - static public $htmlTags = array( + static public $htmlTags = [ 'allow' => 'table|td|th|tr|i|b|u|strong|img|p|br|div|strong|em|ul|ol|li|dl|dd|dt|a', 'ban' => 'html|head|meta|link|base|basefont|body|bgsound|title|style|script|form|iframe|frame|frameset|applet|id|ilayer|layer|name|script|style|xml', - ); + ]; static public function filter($data,$filter,$option=''){ return filter_var($data,is_int($filter)?$filter:filter_id($filter),$option); @@ -48,7 +48,7 @@ class Filter { * @return string */ static public function forSearch($string) { - return str_replace( array('%','_'), array('\%','\_'), $string ); + return str_replace( ['%','_'], ['\%','\_'], $string ); } /** @@ -67,7 +67,7 @@ class Filter { * @return string */ static public function forTarea($string) { - return str_ireplace(array(''), array('<textarea>','</textarea>'), $string); + return str_ireplace([''], ['<textarea>','</textarea>'], $string); } /** @@ -77,7 +77,7 @@ class Filter { * @return string */ static public function forTag($string) { - return str_replace(array('"',"'"), array('"','''), $string); + return str_replace(['"',"'"], ['"','''], $string); } /** @@ -107,7 +107,7 @@ class Filter { * @return string */ static function hsc($string) { - return preg_replace(array("/&/i", "/ /i"), array('&', '&nbsp;'), htmlspecialchars($string, ENT_QUOTES)); + return preg_replace(["/&/i", "/ /i"], ['&', '&nbsp;'], htmlspecialchars($string, ENT_QUOTES)); } /** @@ -117,7 +117,7 @@ class Filter { * @return string */ static function undoHsc($text) { - return preg_replace(array("/>/i", "/</i", "/"/i", "/'/i", '/&nbsp;/i'), array(">", "<", "\"", "'", " "), $text); + return preg_replace(["/>/i", "/</i", "/"/i", "/'/i", '/&nbsp;/i'], [">", "<", "\"", "'", " "], $text); } /** diff --git a/Think/Image/Driver/Gd.php b/Think/Image/Driver/Gd.php index 8bee6062..1fd83652 100644 --- a/Think/Image/Driver/Gd.php +++ b/Think/Image/Driver/Gd.php @@ -50,12 +50,12 @@ class Gd{ } //设置图像信息 - $this->info = array( + $this->info = [ 'width' => $info[0], 'height' => $info[1], 'type' => image_type_to_extension($info[2], false), 'mime' => $info['mime'], - ); + ]; //销毁已存在的图像 empty($this->im) || imagedestroy($this->im); @@ -146,7 +146,7 @@ class Gd{ */ public function size(){ if(empty($this->im)) throw new Exception('没有指定图像资源'); - return array($this->info['width'], $this->info['height']); + return [$this->info['width'], $this->info['height']]; } /** diff --git a/Think/Image/Driver/Imagick.php b/Think/Image/Driver/Imagick.php index b9387b0c..efd370f8 100644 --- a/Think/Image/Driver/Imagick.php +++ b/Think/Image/Driver/Imagick.php @@ -50,12 +50,12 @@ class Imagick{ $this->im = new \Imagick(realpath($imgname)); //设置图像信息 - $this->info = array( + $this->info = [ 'width' => $this->im->getImageWidth(), 'height' => $this->im->getImageHeight(), 'type' => strtolower($this->im->getImageFormat()), 'mime' => $this->im->getImageMimeType(), - ); + ]; } /** @@ -134,7 +134,7 @@ class Imagick{ */ public function size(){ if(empty($this->im)) throw new Exception('没有指定图像资源'); - return array($this->info['width'], $this->info['height']); + return [$this->info['width'], $this->info['height']]; } /** @@ -353,7 +353,7 @@ class Imagick{ //创建水印图像资源 $water = new Imagick(realpath($source)); - $info = array($water->getImageWidth(), $water->getImageHeight()); + $info = [$water->getImageWidth(), $water->getImageHeight()]; /* 设定水印位置 */ switch ($locate) { diff --git a/Think/Input.php b/Think/Input.php index 63a2ac9a..bb878881 100644 --- a/Think/Input.php +++ b/Think/Input.php @@ -82,7 +82,7 @@ class Input { // 过滤表单中的表达式 static private function filter_exp(&$value){ - if (in_array(strtolower($value),array('exp','or'))){ + if (in_array(strtolower($value),['exp','or'])){ $value .= ' '; } } diff --git a/Think/Loader.php b/Think/Loader.php index b29ac1e7..7aed2bc5 100644 --- a/Think/Loader.php +++ b/Think/Loader.php @@ -89,7 +89,7 @@ class Loader { }elseif (in_array($class_strut[0], ['Org','Com'])) { // org 第三方公共类库 com 企业公共类库 $baseUrl = LIB_PATH; - }elseif(in_array($class_strut[0], ['Think','Vendor','Traits'])){ + }elseif(in_array($class_strut[0], ['Think','Vendor','Library','Traits'])){ $baseUrl = THINK_PATH; }else { // 加载其他项目应用类库 $class = substr_replace($class, '', 0, strlen($class_strut[0]) + 1); @@ -206,7 +206,7 @@ class Loader { if(is_string($vars)) { parse_str($vars,$vars); } - return call_user_func_array(array(&$class,$action.Config::get('action_suffix')),$vars); + return call_user_func_array([&$class,$action.Config::get('action_suffix')],$vars); }else{ return false; } @@ -225,7 +225,7 @@ class Loader { if(class_exists($class)){ $o = new $class(); if(!empty($method) && method_exists($o,$method)) - $_instance[$identify] = call_user_func_array(array(&$o, $method)); + $_instance[$identify] = call_user_func_array([&$o, $method]); else $_instance[$identify] = $o; } diff --git a/Think/Model.php b/Think/Model.php index 62564725..e20dfd64 100644 --- a/Think/Model.php +++ b/Think/Model.php @@ -11,12 +11,15 @@ // $Id$ namespace Think; + class Model { + //use Think\Model\Traits\ActiveRecord; // 操作状态 const MODEL_INSERT = 1; // 插入模型数据 const MODEL_UPDATE = 2; // 更新模型数据 const MODEL_BOTH = 3; // 包含上面两种方式 + // 当前使用的扩展模型 private $_extModel = null; // 当前数据库操作对象 diff --git a/Think/Validate.php b/Think/Validate.php index 23d8ba0c..00695747 100644 --- a/Think/Validate.php +++ b/Think/Validate.php @@ -169,7 +169,7 @@ class Validate { * @return boolean */ public function regex($value,$rule) { - $validate = array( + $validate = [ 'require' => '/.+/', 'email' => '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/', 'url' => '/^http(s?):\/\/(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/', @@ -179,7 +179,7 @@ class Validate { 'integer' => '/^[-\+]?\d+$/', 'double' => '/^[-\+]?\d+(\.\d+)?$/', 'english' => '/^[A-Za-z]+$/', - ); + ]; // 检查是否有内置的正则表达式 if(isset($validate[strtolower($rule)])) $rule = $validate[strtolower($rule)]; diff --git a/Tpl/dispatch_jump.tpl b/Tpl/dispatch_jump.tpl index 585efa59..bf035c83 100644 --- a/Tpl/dispatch_jump.tpl +++ b/Tpl/dispatch_jump.tpl @@ -18,10 +18,10 @@ body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16p

:)

-

+

:(

-

+

diff --git a/base.php b/base.php index d43e9d96..a1f17977 100644 --- a/base.php +++ b/base.php @@ -19,7 +19,7 @@ define('THINK_VERSION', '4.0beta'); defined('THINK_PATH') or define('THINK_PATH', dirname(__FILE__).'/'); defined('CORE_PATH') or define('CORE_PATH', THINK_PATH.'Think/'); defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/'); -defined('LIB_PATH') or define('LIB_PATH', APP_PATH.'Library/'); +defined('LIB_PATH') or define('LIB_PATH', THINK_PATH.'Library/'); defined('RUNTIME_PATH') or define('RUNTIME_PATH', realpath(APP_PATH).'/Runtime/'); defined('DATA_PATH') or define('DATA_PATH', RUNTIME_PATH.'Data/'); defined('LOG_PATH') or define('LOG_PATH', RUNTIME_PATH.'Log/'); diff --git a/start.php b/start.php index f43dbc88..0812ec28 100644 --- a/start.php +++ b/start.php @@ -16,7 +16,7 @@ namespace Think; //-------------------------- // 加载基础文件 -require dirname(__FILE__).'/base.php'; +require __DIR__.'/base.php'; require CORE_PATH.'Loader.php'; // 注册自动加载 @@ -36,17 +36,14 @@ set_exception_handler(['Think\Error','appException']); // 导入系统惯例 Config::load(THINK_PATH.'convention.php'); +// 初始化操作可以在应用的公共文件中处理 下面只是示例 +//--------------------------------------------------- // 日志初始化 Log::init(['type'=>Config::get('log_type'),'log_path'=> Config::get('log_path')]); // 缓存初始化 Cache::connect(['type'=>'File','temp'=> CACHE_PATH]); - -// 注册行为扩展 -//Tag::add('content_filter','ContentReplace','Think'); -//Tag::add('app_end','ShowPageTrace','Think'); -Tag::add('view_template','LocationTemplate','Think'); - +//------------------------------------------------------ // 启动session if(!IS_CLI) {