diff --git a/core/base.php b/core/base.php index bf1276f2..dcbeec7f 100644 --- a/core/base.php +++ b/core/base.php @@ -9,7 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- -define('THINK_VERSION', '5.0.0 RC4'); +define('THINK_VERSION', '5.0.0'); define('THINK_START_TIME', microtime(true)); define('THINK_START_MEM', memory_get_usage()); define('EXT', '.php'); diff --git a/core/library/think/App.php b/core/library/think/App.php index 20c671fc..12748712 100644 --- a/core/library/think/App.php +++ b/core/library/think/App.php @@ -237,7 +237,11 @@ class App { if (empty($vars)) { // 自动获取请求变量 - $vars = Request::instance()->param(); + if (Config::get('url_param_type')) { + $vars = Request::instance()->route(); + } else { + $vars = Request::instance()->param(); + } } $args = []; // 判断数组类型 数字数组时按顺序绑定参数 diff --git a/core/library/think/Session.php b/core/library/think/Session.php index 37afca2c..bc57f3cd 100644 --- a/core/library/think/Session.php +++ b/core/library/think/Session.php @@ -178,6 +178,23 @@ class Session return $value; } + /** + * session获取并删除 + * @param string $name session名称 + * @param string|null $prefix 作用域(前缀) + * @return mixed + */ + public static function pull($name, $prefix = null) + { + $result = self::get($name, $prefix); + if ($result) { + self::delete($name, $prefix); + return $result; + } else { + return null; + } + } + /** * 删除session数据 * @param string $name session名称 diff --git a/core/library/think/View.php b/core/library/think/View.php index 5ec258e1..da087036 100644 --- a/core/library/think/View.php +++ b/core/library/think/View.php @@ -61,7 +61,6 @@ class View { if (is_array($name)) { $this->data = array_merge($this->data, $name); - return $this; } else { $this->data[$name] = $value; } diff --git a/core/library/think/cache/Driver.php b/core/library/think/cache/Driver.php index 021ae727..f77ac30b 100644 --- a/core/library/think/cache/Driver.php +++ b/core/library/think/cache/Driver.php @@ -91,6 +91,23 @@ abstract class Driver return $this->options['prefix'] . $name; } + /** + * 读取缓存并删除 + * @access public + * @param string $name 缓存变量名 + * @return mixed + */ + public function pull($name) + { + $result = $this->get($name, false); + if ($result) { + $this->rm($name); + return $result; + } else { + return null; + } + } + /** * 缓存标签 * @access public diff --git a/core/library/think/exception/ClassNotFoundException.php b/core/library/think/exception/ClassNotFoundException.php index 0bca424d..eb22e730 100644 --- a/core/library/think/exception/ClassNotFoundException.php +++ b/core/library/think/exception/ClassNotFoundException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/core/library/think/exception/Handle.php b/core/library/think/exception/Handle.php index 0b1f6bc0..ad05c70b 100644 --- a/core/library/think/exception/Handle.php +++ b/core/library/think/exception/Handle.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/core/library/think/exception/HttpException.php b/core/library/think/exception/HttpException.php index ef6bbd82..01a27fc2 100644 --- a/core/library/think/exception/HttpException.php +++ b/core/library/think/exception/HttpException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/core/library/think/exception/HttpResponseException.php b/core/library/think/exception/HttpResponseException.php index ff718f58..52972867 100644 --- a/core/library/think/exception/HttpResponseException.php +++ b/core/library/think/exception/HttpResponseException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/core/library/think/exception/TemplateNotFoundException.php b/core/library/think/exception/TemplateNotFoundException.php index 24105c42..42020693 100644 --- a/core/library/think/exception/TemplateNotFoundException.php +++ b/core/library/think/exception/TemplateNotFoundException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/core/library/think/exception/ThrowableError.php b/core/library/think/exception/ThrowableError.php index 54823d78..87b6b9d7 100644 --- a/core/library/think/exception/ThrowableError.php +++ b/core/library/think/exception/ThrowableError.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/core/library/think/exception/ValidateException.php b/core/library/think/exception/ValidateException.php index 03599f5b..b3684169 100644 --- a/core/library/think/exception/ValidateException.php +++ b/core/library/think/exception/ValidateException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/core/library/think/response/Redirect.php b/core/library/think/response/Redirect.php index 81b7b050..220eef25 100644 --- a/core/library/think/response/Redirect.php +++ b/core/library/think/response/Redirect.php @@ -58,6 +58,7 @@ class Redirect extends Response } else { Session::set($name, $value); } + return $this; } /** diff --git a/core/library/think/template/taglib/Cx.php b/core/library/think/template/taglib/Cx.php index 6b27ea82..b15c7bba 100644 --- a/core/library/think/template/taglib/Cx.php +++ b/core/library/think/template/taglib/Cx.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +----------------------------------------------------------------------