改进Response类的redirect方法 Controller类的前置操作定义改进

This commit is contained in:
thinkphp
2016-02-14 23:48:25 +08:00
parent 00f226a6f9
commit 3b9c814f3c
2 changed files with 7 additions and 1 deletions

View File

@@ -56,10 +56,16 @@ class Controller
protected function beforeAction($method, $options = [])
{
if (isset($options['only'])) {
if (is_string($options['only'])) {
$options['only'] = explode(',', $options['only']);
}
if (!in_array(ACTION_NAME, $options['only'])) {
return;
}
} elseif (isset($options['except'])) {
if (is_string($options['except'])) {
$options['except'] = explode(',', $options['except']);
}
if (in_array(ACTION_NAME, $options['except'])) {
return;
}