diff --git a/Think/Auto.php b/Think/Auto.php
index e1805b3a..d7848b95 100644
--- a/Think/Auto.php
+++ b/Think/Auto.php
@@ -12,7 +12,7 @@
namespace Think;
class Auto {
- protected $auto = array();
+ protected $auto = [];
public function rule($rule){
$this->auto = $rule;
@@ -33,7 +33,7 @@ class Auto {
// array('field','填充内容','附加规则',[额外参数])
switch(trim($auto[2])) {
case 'callback': // 使用回调方法
- $args = isset($auto[3])?(array)$auto[3]:array();
+ $args = isset($auto[3])?(array)$auto[3]:[];
if(isset($data[$auto[0]])) {
array_unshift($args,$data[$auto[0]]);
}
diff --git a/Think/Behavior/ShowPageTrace.php b/Think/Behavior/ShowPageTrace.php
index aedcba94..c0b65621 100644
--- a/Think/Behavior/ShowPageTrace.php
+++ b/Think/Behavior/ShowPageTrace.php
@@ -36,11 +36,11 @@ class ShowPageTrace {
private function showTrace() {
// 系统默认显示信息
$files = get_included_files();
- $info = array();
+ $info = [];
foreach ($files as $key=>$file){
$info[] = $file.' ( '.number_format(filesize($file)/1024,2).' KB )';
}
- $trace = array();
+ $trace = [];
Debug::remark('START',$GLOBALS['startTime']);
$base = array(
'请求信息' => date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.$_SERVER['PHP_SELF'],
@@ -70,9 +70,9 @@ class ShowPageTrace {
$name = strtoupper($name);
if(strpos($name,'|')) {// 多组信息
$array = explode('|',$name);
- $result = array();
+ $result = [];
foreach($array as $name){
- $result += isset($debug[$name])?$debug[$name]:array();
+ $result += isset($debug[$name])?$debug[$name]:[];
}
$trace[$title] = $result;
}else{
diff --git a/Think/Behavior/read_html_cache.php b/Think/Behavior/read_html_cache.php
index 2a9f1072..086a3564 100644
--- a/Think/Behavior/read_html_cache.php
+++ b/Think/Behavior/read_html_cache.php
@@ -20,7 +20,7 @@ class ReadHtmlCacheBehavior {
protected $options = array(
'HTML_CACHE_ON' => false,
'HTML_CACHE_TIME' => 60,
- 'HTML_CACHE_RULES' => array(),
+ 'HTML_CACHE_RULES' => [],
'HTML_FILE_SUFFIX' => '.html',
);
diff --git a/Think/Behavior/token_build.php b/Think/Behavior/token_build.php
index cda80e4e..cdce04b9 100644
--- a/Think/Behavior/token_build.php
+++ b/Think/Behavior/token_build.php
@@ -45,7 +45,7 @@ class TokenBuildBehavior extends Behavior {
$tokenName = C('TOKEN_NAME');
$tokenType = C('TOKEN_TYPE');
if(!isset($_SESSION[$tokenName])) {
- $_SESSION[$tokenName] = array();
+ $_SESSION[$tokenName] = [];
}
// 标识当前页面唯一性
$tokenKey = md5($_SERVER['REQUEST_URI']);
diff --git a/Think/Cache/Driver/Apc.php b/Think/Cache/Driver/Apc.php
index e40e23f2..0dc68e7c 100644
--- a/Think/Cache/Driver/Apc.php
+++ b/Think/Cache/Driver/Apc.php
@@ -28,7 +28,7 @@ class Apc {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if(!function_exists('apc_cache_info')) {
throw New Exception('_NOT_SUPPERT_:Apc');
}
@@ -65,7 +65,7 @@ class Apc {
// 记录缓存队列
$queue = apc_fetch('__info__');
if(!$queue) {
- $queue = array();
+ $queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {
diff --git a/Think/Cache/Driver/Db.php b/Think/Cache/Driver/Db.php
index ab4c0d37..d4914eef 100644
--- a/Think/Cache/Driver/Db.php
+++ b/Think/Cache/Driver/Db.php
@@ -36,7 +36,7 @@ class Db {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
@@ -101,7 +101,7 @@ class Db {
$queue = xcache_get('__info__');
if(!$result) {
$this->handler->execute('INSERT INTO '.$this->options['table'].' (`cachekey`,`data`,`expire`) VALUES (\'__info__\',\'\',0)');
- $queue = array();
+ $queue = [];
}else{
$queue = unserialize($result[0]['data']);
}
diff --git a/Think/Cache/Driver/Eaccelerator.php b/Think/Cache/Driver/Eaccelerator.php
index 2ce26162..0bbf6c98 100644
--- a/Think/Cache/Driver/Eaccelerator.php
+++ b/Think/Cache/Driver/Eaccelerator.php
@@ -26,7 +26,7 @@ class Eaccelerator {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
@@ -61,7 +61,7 @@ class Eaccelerator {
// 记录缓存队列
$queue = eaccelerator_get('__info__');
if(!$queue) {
- $queue = array();
+ $queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {
diff --git a/Think/Cache/Driver/File.php b/Think/Cache/Driver/File.php
index e0dee86a..b0af01b8 100644
--- a/Think/Cache/Driver/File.php
+++ b/Think/Cache/Driver/File.php
@@ -29,7 +29,7 @@ class File {
* 架构函数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
@@ -133,7 +133,7 @@ class File {
$queue_file = dirname($filename).'/__info__.php';
$queue = unserialize(file_get_contents($queue_file));
if(!$queue) {
- $queue = array();
+ $queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {
diff --git a/Think/Cache/Driver/Memcache.php b/Think/Cache/Driver/Memcache.php
index df05bd91..809c574b 100644
--- a/Think/Cache/Driver/Memcache.php
+++ b/Think/Cache/Driver/Memcache.php
@@ -29,7 +29,7 @@ class Memcache {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if ( !extension_loaded('memcache') ) {
throw new Exception('_NOT_SUPPERT_:memcache');
}
@@ -71,7 +71,7 @@ class Memcache {
// 记录缓存队列
$queue = $this->handler->get('__info__');
if(!$queue) {
- $queue = array();
+ $queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {
diff --git a/Think/Cache/Driver/Redis.php b/Think/Cache/Driver/Redis.php
index 217e3ce0..37d12bd3 100644
--- a/Think/Cache/Driver/Redis.php
+++ b/Think/Cache/Driver/Redis.php
@@ -30,7 +30,7 @@ class Redis {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if ( !extension_loaded('redis') ) {
throw new Exception('_NOT_SUPPERT_:redis');
}
@@ -77,7 +77,7 @@ class Redis {
// 记录缓存队列
$queue = $this->handler->get('__info__');
if(!$queue) {
- $queue = array();
+ $queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {
diff --git a/Think/Cache/Driver/Secache.php b/Think/Cache/Driver/Secache.php
index 85b08346..68376d1e 100644
--- a/Think/Cache/Driver/Secache.php
+++ b/Think/Cache/Driver/Secache.php
@@ -29,7 +29,7 @@ class Secache {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
@@ -67,7 +67,7 @@ class Secache {
// 记录缓存队列
$queue = $this->handler->fetch(md5('__info__'));
if(!$queue) {
- $queue = array();
+ $queue = [];
}
if(false===array_search($key, $queue)) array_push($queue,$key);
if(count($queue) > $this->options['length']) {
@@ -669,7 +669,7 @@ class secache{
}
function _all_schemas(){
- $schema = array();
+ $schema = [];
for($i=0;$i<16;$i++){
$this->_seek(60+$i*$this->schema_item_size);
$info = unpack('V1'.implode('/V1',$this->schema_struct),fread($this->_rs,$this->schema_item_size));
@@ -683,7 +683,7 @@ class secache{
}
function schemaStatus(){
- $return = array();
+ $return = [];
foreach($this->_all_schemas() as $k=>$schemaItem){
if($schemaItem['free']){
$this->_dfollow($schemaItem['free'],$schemaItem['freecount']);
diff --git a/Think/Cache/Driver/Simple.php b/Think/Cache/Driver/Simple.php
index 09f348d6..ec95f548 100644
--- a/Think/Cache/Driver/Simple.php
+++ b/Think/Cache/Driver/Simple.php
@@ -24,7 +24,7 @@ class Simple {
* 架构函数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
diff --git a/Think/Cache/Driver/Sqlite.php b/Think/Cache/Driver/Sqlite.php
index 893fa357..f3e8eed2 100644
--- a/Think/Cache/Driver/Sqlite.php
+++ b/Think/Cache/Driver/Sqlite.php
@@ -29,7 +29,7 @@ class Sqlite {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if ( !extension_loaded('sqlite') ) {
throw new Exception('_NOT_SUPPERT_:sqlite');
}
diff --git a/Think/Cache/Driver/Wincache.php b/Think/Cache/Driver/Wincache.php
index cbc35948..c83e2e51 100644
--- a/Think/Cache/Driver/Wincache.php
+++ b/Think/Cache/Driver/Wincache.php
@@ -26,7 +26,7 @@ class Wincache {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if ( !function_exists('wincache_ucache_info') ) {
throw new Exception('_NOT_SUPPERT_:WinCache');
}
@@ -64,7 +64,7 @@ class Wincache {
// 记录缓存队列
$queue = wincache_ucache_get('__info__');
if(!$queue) {
- $queue = array();
+ $queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {
diff --git a/Think/Cache/Driver/Xcache.php b/Think/Cache/Driver/Xcache.php
index 2d65c209..7d22e276 100644
--- a/Think/Cache/Driver/Xcache.php
+++ b/Think/Cache/Driver/Xcache.php
@@ -26,7 +26,7 @@ class Xcache {
* @param array $options 缓存参数
* @access public
*/
- public function __construct($options=array()) {
+ public function __construct($options=[]) {
if ( !function_exists('xcache_info') ) {
throw new Exception('_NOT_SUPPERT_:Xcache');
}
@@ -67,7 +67,7 @@ class Xcache {
// 记录缓存队列
$queue = xcache_get('__info__');
if(!$queue) {
- $queue = array();
+ $queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {
diff --git a/Think/Controller.php b/Think/Controller.php
index 6395ac1b..3ec88feb 100644
--- a/Think/Controller.php
+++ b/Think/Controller.php
@@ -117,7 +117,7 @@ class Controller {
*/
private function dispatchJump($message,$status=1,$jumpUrl='',$ajax=false) {
if(true === $ajax || IS_AJAX) {// AJAX提交
- $data = is_array($ajax)?$ajax:array();
+ $data = is_array($ajax)?$ajax:[];
$data['info'] = $message;
$data['status'] = $status;
$data['url'] = $jumpUrl;
diff --git a/Think/Db/Driver/Mysql.php b/Think/Db/Driver/Mysql.php
index 6a70c0f4..7fdcea6d 100644
--- a/Think/Db/Driver/Mysql.php
+++ b/Think/Db/Driver/Mysql.php
@@ -26,7 +26,7 @@ class Mysql extends Driver{
$this->initConnect(true);
$sql = 'SHOW COLUMNS FROM `'.$tableName.'`';
$result = $this->query($sql);
- $info = array();
+ $info = [];
if($result) {
foreach ($result as $key => $val) {
$info[$val['Field']] = array(
@@ -49,7 +49,7 @@ class Mysql extends Driver{
public function getTables($dbName='') {
$sql = !empty($dbName)?'SHOW TABLES FROM '.$dbName:'SHOW TABLES ';
$result = $this->query($sql);
- $info = array();
+ $info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}
diff --git a/Think/Db/Driver/Oracle.php b/Think/Db/Driver/Oracle.php
index d7bbc389..d04e1e94 100644
--- a/Think/Db/Driver/Oracle.php
+++ b/Think/Db/Driver/Oracle.php
@@ -69,7 +69,7 @@ class Oracle extends Driver{
."from user_tab_columns a,(select column_name from user_constraints c,user_cons_columns col "
."where c.constraint_name=col.constraint_name and c.constraint_type='P'and c.table_name='".strtoupper($tableName)
."') b where table_name='".strtoupper($tableName)."' and a.column_name=b.column_name(+)");
- $info = array();
+ $info = [];
if($result) {
foreach ($result as $key => $val) {
$info[strtolower($val['column_name'])] = array(
@@ -91,7 +91,7 @@ class Oracle extends Driver{
*/
public function getTables($dbName='') {
$result = $this->query("select table_name from user_tables");
- $info = array();
+ $info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}
diff --git a/Think/Db/Driver/Pgsql.php b/Think/Db/Driver/Pgsql.php
index 84fb5952..6efc0ec8 100644
--- a/Think/Db/Driver/Pgsql.php
+++ b/Think/Db/Driver/Pgsql.php
@@ -26,7 +26,7 @@ class Pgsql extends Driver{
*/
public function getFields($tableName) {
$result = $this->query('select fields_name as "Field",fields_type as "Type",fields_not_null as "Null",fields_key_name as "Key",fields_default as "Default",fields_default as "Extra" from table_msg('.$tableName.');');
- $info = array();
+ $info = [];
if($result){
foreach ($result as $key => $val) {
$info[$val['Field']] = array(
@@ -49,7 +49,7 @@ class Pgsql extends Driver{
*/
public function getTables($dbName='') {
$result = $this->query("select tablename as Tables_in_test from pg_tables where schemaname ='public'");
- $info = array();
+ $info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}
diff --git a/Think/Db/Driver/Sqlite.php b/Think/Db/Driver/Sqlite.php
index 3bebe8ec..2021d495 100644
--- a/Think/Db/Driver/Sqlite.php
+++ b/Think/Db/Driver/Sqlite.php
@@ -26,7 +26,7 @@ class Sqlite extends Driver {
*/
public function getFields($tableName) {
$result = $this->query('PRAGMA table_info( '.$tableName.' )');
- $info = array();
+ $info = [];
if($result){
foreach ($result as $key => $val) {
$info[$val['Field']] = array(
@@ -51,7 +51,7 @@ class Sqlite extends Driver {
$result = $this->query("SELECT name FROM sqlite_master WHERE type='table' "
. "UNION ALL SELECT name FROM sqlite_temp_master "
. "WHERE type='table' ORDER BY name");
- $info = array();
+ $info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}
diff --git a/Think/Db/Driver/Sqlsrv.php b/Think/Db/Driver/Sqlsrv.php
index 8268cb1d..85f8c220 100644
--- a/Think/Db/Driver/Sqlsrv.php
+++ b/Think/Db/Driver/Sqlsrv.php
@@ -34,7 +34,7 @@ class Sqlsrv extends Driver{
AND t.table_schema = c.table_schema
AND t.table_name = c.table_name
WHERE t.table_name = '$tableName'");
- $info = array();
+ $info = [];
if($result) {
foreach ($result as $key => $val) {
$info[$val['column_name']] = array(
@@ -60,7 +60,7 @@ class Sqlsrv extends Driver{
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
");
- $info = array();
+ $info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}
@@ -117,7 +117,7 @@ class Sqlsrv extends Driver{
* @param array $options 表达式
* @return false | integer
*/
- public function delete($options=array()) {
+ public function delete($options=[]) {
$this->model = $options['model'];
$sql = 'DELETE FROM '
.$this->parseTable($options['table'])
diff --git a/Think/Error.php b/Think/Error.php
index 79829a6b..d16d88ef 100644
--- a/Think/Error.php
+++ b/Think/Error.php
@@ -18,7 +18,7 @@ class Error {
* @param mixed $e 异常对象
*/
static public function appException($e) {
- $error = array();
+ $error = [];
$error['message'] = $e->getMessage();
$error['file'] = $e->getFile();
$error['line'] = $e->getLine();
@@ -77,7 +77,7 @@ class Error {
if(IS_CLI) {
exit(is_array($error)?$error['message']:$error);
}
- $e = array();
+ $e = [];
if (Config::get('app_debug')) {
//调试模式下输出错误信息
if (!is_array($error)) {
diff --git a/Think/Image/Driver/Gif.php b/Think/Image/Driver/Gif.php
index 4d5d42a5..8fbfba97 100644
--- a/Think/Image/Driver/Gif.php
+++ b/Think/Image/Driver/Gif.php
@@ -16,13 +16,13 @@ class Gif{
* GIF帧列表
* @var array
*/
- private $frames = array();
+ private $frames = [];
/**
* 每帧等待时间列表
* @var array
*/
- private $delays = array();
+ private $delays = [];
/**
* 构造方法,用于解码GIF图片
diff --git a/Think/Input.php b/Think/Input.php
index 64de2f9d..2f4a3c4a 100644
--- a/Think/Input.php
+++ b/Think/Input.php
@@ -21,7 +21,7 @@ class Input {
* @param array $args 参数 array(key,filter,default)
* @return mixed
*/
- static public function __callStatic($type,$args=array()) {
+ static public function __callStatic($type,$args=[]) {
switch(strtolower($type)) {
case 'get': $input =& $_GET;break;
case 'post': $input =& $_POST;break;
diff --git a/Think/Log/Driver/File.php b/Think/Log/Driver/File.php
index 1b6b4e7e..9adb020d 100644
--- a/Think/Log/Driver/File.php
+++ b/Think/Log/Driver/File.php
@@ -20,14 +20,14 @@ class File {
const SAPI = 4;
// 日志信息
- protected $log = array();
+ protected $log = [];
protected $config = array(
'log_time_format' => '[ c ]',
'log_file_size' => 2097152,
'log_allow_level' => array('ERR','NOTIC','DEBUG','SQL','INFO'),
);
- public function __construct($config=array()){
+ public function __construct($config=[]){
$this->config = array_merge($this->config,$config);
}
@@ -75,12 +75,12 @@ class File {
$message = date($this->config['log_time_format']).' '.$_SERVER['REMOTE_ADDR'].' '.$_SERVER['REQUEST_URI']."\r\n";
if($level) {
$message .= implode('',$log)."\r\n";
- $this->log[$level] = array();
+ $this->log[$level] = [];
}else{
foreach($log as $info){
$message .= implode('',$info)."\r\n";
}
- $this->log = array();
+ $this->log = [];
}
error_log($message, 3,$destination);
//clearstatcache();
diff --git a/Think/Oauth/Driver.php b/Think/Oauth/Driver.php
index 8f05458d..4abf8ddd 100644
--- a/Think/Oauth/Driver.php
+++ b/Think/Oauth/Driver.php
@@ -173,7 +173,7 @@ abstract class Driver {
* @param string $method 请求方法GET/POST
* @return array $data 响应数据
*/
- protected function http($url, $params, $method = 'GET', $header = array()){
+ protected function http($url, $params, $method = 'GET', $header = []){
$vars = http_build_query($params);
$opts = array(
CURLOPT_TIMEOUT => 30,
diff --git a/Think/Oauth/Driver/Douban.php b/Think/Oauth/Driver/Douban.php
index e9e1faa7..94c4aa43 100644
--- a/Think/Oauth/Driver/Douban.php
+++ b/Think/Oauth/Driver/Douban.php
@@ -39,7 +39,7 @@ class Douban extends Driver{
*/
public function call($api, $param = '', $method = 'GET'){
/* 豆瓣调用公共参数 */
- $params = array();
+ $params = [];
$header = array("Authorization: Bearer {$this->token['access_token']}");
$data = $this->http($this->url($api), $this->param($params, $param), $method, $header);
return json_decode($data, true);
diff --git a/Think/Oauth/Driver/Github.php b/Think/Oauth/Driver/Github.php
index e037c994..5ab3335d 100644
--- a/Think/Oauth/Driver/Github.php
+++ b/Think/Oauth/Driver/Github.php
@@ -39,7 +39,7 @@ class Github extends Driver{
*/
public function call($api, $param = '', $method = 'GET'){
/* Github 调用公共参数 */
- $params = array();
+ $params = [];
$header = array("Authorization: bearer {$this->token['access_token']}");
$data = $this->http($this->url($api), $this->param($params, $param), $method, $header);
diff --git a/Think/Oauth/Driver/Google.php b/Think/Oauth/Driver/Google.php
index d5fe8e4c..d30a7f5d 100644
--- a/Think/Oauth/Driver/Google.php
+++ b/Think/Oauth/Driver/Google.php
@@ -45,7 +45,7 @@ class Google extends Driver{
*/
public function call($api, $param = '', $method = 'GET'){
/* Google 调用公共参数 */
- $params = array();
+ $params = [];
$header = array("Authorization: Bearer {$this->token['access_token']}");
$data = $this->http($this->url($api), $this->param($params, $param), $method, $header);
diff --git a/Think/Oauth/Driver/Renren.php b/Think/Oauth/Driver/Renren.php
index 696567b7..f8ca4957 100644
--- a/Think/Oauth/Driver/Renren.php
+++ b/Think/Oauth/Driver/Renren.php
@@ -61,7 +61,7 @@ class Renren extends Driver{
/* 签名 */
ksort($params);
- $param = array();
+ $param = [];
foreach ($params as $key => $value){
$param[] = "{$key}={$value}";
}
diff --git a/Think/Template/Taglib/Cx.php b/Think/Template/Taglib/Cx.php
index e9522e2d..0b633977 100644
--- a/Think/Template/Taglib/Cx.php
+++ b/Think/Template/Taglib/Cx.php
@@ -21,30 +21,30 @@ use Think\TagLib;
class Cx extends TagLib {
// 标签定义
- protected $tags = array(
+ protected $tags = [
// 标签定义: attr 属性列表 close 是否闭合(0 或者1 默认1) alias 标签别名 level 嵌套层次
- 'php' => array(),
- 'volist' => array('attr'=>'name,id,offset,length,key,mod','level'=>3,'alias'=>'iterate'),
- 'foreach' => array('attr'=>'name,item,key','level'=>3),
- 'if' => array('attr'=>'condition','level'=>2),
- 'elseif' => array('attr'=>'condition','close'=>0),
- 'else' => array('attr'=>'','close'=>0),
- 'switch' => array('attr'=>'name','level'=>2),
- 'case' => array('attr'=>'value,break'),
- 'default' => array('attr'=>'','close'=>0),
- 'compare' => array('attr'=>'name,value,type','level'=>3,'alias'=>'eq,equal,notequal,neq,gt,lt,egt,elt,heq,nheq'),
- 'range' => array('attr'=>'name,value,type','level'=>3,'alias'=>'in,notin,between,notbetween'),
- 'empty' => array('attr'=>'name','level'=>3),
- 'notempty' => array('attr'=>'name','level'=>3),
- 'present' => array('attr'=>'name','level'=>3),
- 'notpresent'=> array('attr'=>'name','level'=>3),
- 'defined' => array('attr'=>'name','level'=>3),
- 'notdefined'=> array('attr'=>'name','level'=>3),
- 'import' => array('attr'=>'file,href,type,value,basepath','close'=>0,'alias'=>'load,css,js'),
- 'assign' => array('attr'=>'name,value','close'=>0),
- 'define' => array('attr'=>'name,value','close'=>0),
- 'for' => array('attr'=>'start,end,name,comparison,step', 'level'=>3),
- );
+ 'php' => [],
+ 'volist' => ['attr'=>'name,id,offset,length,key,mod','level'=>3,'alias'=>'iterate'],
+ 'foreach' => ['attr'=>'name,item,key','level'=>3],
+ 'if' => ['attr'=>'condition','level'=>2],
+ 'elseif' => ['attr'=>'condition','close'=>0],
+ 'else' => ['attr'=>'','close'=>0],
+ 'switch' => ['attr'=>'name','level'=>2],
+ 'case' => ['attr'=>'value,break'],
+ 'default' => ['attr'=>'','close'=>0],
+ 'compare' => ['attr'=>'name,value,type','level'=>3,'alias'=>'eq,equal,notequal,neq,gt,lt,egt,elt,heq,nheq'],
+ 'range' => ['attr'=>'name,value,type','level'=>3,'alias'=>'in,notin,between,notbetween'],
+ 'empty' => ['attr'=>'name','level'=>3],
+ 'notempty' => ['attr'=>'name','level'=>3],
+ 'present' => ['attr'=>'name','level'=>3],
+ 'notpresent'=> ['attr'=>'name','level'=>3],
+ 'defined' => ['attr'=>'name','level'=>3],
+ 'notdefined'=> ['attr'=>'name','level'=>3],
+ 'import' => ['attr'=>'file,href,type,value,basepath','close'=>0,'alias'=>'load,css,js'],
+ 'assign' => ['attr'=>'name,value','close'=>0],
+ 'define' => ['attr'=>'name,value','close'=>0],
+ 'for' => ['attr'=>'start,end,name,comparison,step', 'level'=>3],
+ ];
/**
* php标签解析
@@ -498,10 +498,10 @@ class Cx extends TagLib {
list($val,$version) = explode('?',$val);
switch($type) {
case 'js':
- $parseStr .= '';
+ $parseStr .= '';
break;
case 'css':
- $parseStr .= '';
+ $parseStr .= '';
break;
case 'php':
$parseStr .= '';
diff --git a/Think/Url.php b/Think/Url.php
index af3a86c5..f8fb7003 100644
--- a/Think/Url.php
+++ b/Think/Url.php
@@ -66,7 +66,7 @@ class Url {
if(is_string($vars)) { // aaa=1&bbb=2 转换成数组
parse_str($vars,$vars);
}elseif(!is_array($vars)){
- $vars = array();
+ $vars = [];
}
if(isset($info['query'])) { // 解析地址里面参数 合并到vars
parse_str($info['query'],$params);
@@ -89,7 +89,7 @@ class Url {
// 解析分组、模块和操作
$url = trim($url,$depr);
$path = explode($depr,$url);
- $var = array();
+ $var = [];
$var[Config::get('var_action')] = !empty($path)?array_pop($path):ACTION_NAME;
if(Config::get('require_controller')) {
$var[Config::get('var_controller')] = !empty($path)?array_pop($path):CONTROLLER_NAME;
diff --git a/Think/Validate.php b/Think/Validate.php
index 9efe5873..53bbe655 100644
--- a/Think/Validate.php
+++ b/Think/Validate.php
@@ -12,7 +12,7 @@
namespace Think;
class Validate {
- protected $validate = array(); // 自动验证定义
+ protected $validate = []; // 自动验证定义
// 是否批处理验证
protected $patchValidate = false;
protected $error = '';
@@ -29,12 +29,12 @@ class Validate {
* @param string $type 创建类型
* @return boolean
*/
- public function valid($data,$rule=array()) {
+ public function valid($data,$rule=[]) {
$validate = $rule?$rule:$this->validate;
// 属性验证
if($validate) { // 如果设置了数据自动验证则进行数据验证
if($this->patchValidate) { // 重置验证错误信息
- $this->error = array();
+ $this->error = [];
}
foreach($validate as $key=>$val) {
// 验证因子定义格式
@@ -87,7 +87,7 @@ class Validate {
protected function _validationFieldItem($data,$val) {
switch(strtolower(trim($val[4]))) {
case 'callback':// 调用方法进行验证
- $args = isset($val[5])?(array)$val[5]:array();
+ $args = isset($val[5])?(array)$val[5]:[];
if(is_string($val[0]) && strpos($val[0], ','))
$val[0] = explode(',', $val[0]);
if(is_array($val[0])){