mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进Response类的redirect方法 Controller类的前置操作定义改进
This commit is contained in:
@@ -56,10 +56,16 @@ class Controller
|
|||||||
protected function beforeAction($method, $options = [])
|
protected function beforeAction($method, $options = [])
|
||||||
{
|
{
|
||||||
if (isset($options['only'])) {
|
if (isset($options['only'])) {
|
||||||
|
if (is_string($options['only'])) {
|
||||||
|
$options['only'] = explode(',', $options['only']);
|
||||||
|
}
|
||||||
if (!in_array(ACTION_NAME, $options['only'])) {
|
if (!in_array(ACTION_NAME, $options['only'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} elseif (isset($options['except'])) {
|
} elseif (isset($options['except'])) {
|
||||||
|
if (is_string($options['except'])) {
|
||||||
|
$options['except'] = explode(',', $options['except']);
|
||||||
|
}
|
||||||
if (in_array(ACTION_NAME, $options['except'])) {
|
if (in_array(ACTION_NAME, $options['except'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class Response
|
|||||||
public static function redirect($url, $params = [])
|
public static function redirect($url, $params = [])
|
||||||
{
|
{
|
||||||
$http_response_code = 301;
|
$http_response_code = 301;
|
||||||
if (in_array($params, [301, 302])) {
|
if (is_int($params) && in_array($params, [301, 302])) {
|
||||||
$http_response_code = $params;
|
$http_response_code = $params;
|
||||||
$params = [];
|
$params = [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user