CakePHP 3.7 Url 正在添加到查询字符串
CakePHP 3.7 Url is adding to query String
单击导航栏时使用 cakephp 3.7 新 url 添加到参数的查询字符串中,这是结果
Link 应该将用户重定向到
http://merchant1.com/users/gallery
但实际上在它下面的浏览器地址栏中,重定向到
http://merchant1.com/users/merchant?redirect=%2Fhqusers%2Fgallery
这里是$this->request->params的调试结果
Array (
[controller] => users
[action] => merchant
[pass] => Array
(
)
[plugin] =>
[_matchedRoute] => /:controller/:action/*
[?] => Array
(
[redirect] => /users/gallery
)
[_ext] =>
[isAjax] =>
)
下面是授权配置
$this->Auth->config([
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'email',
'password' => 'password'
],
'userModel' => 'Users'
]
],
'loginAction' => [
'controller' => 'users',
'action' => 'login'
],
'loginRedirect' => [
'controller' => 'users',
'action' => 'login'
],
'logoutRedirect' => [
'controller' => 'users',
'action' => 'logout'
],
'storage' => [
'className' => 'Session',
'key' => 'Auth.users'
]
]);
这里有什么问题。
找到上述问题的解决方案
我必须更换
$this->Auth->allow('gallery')
到
$this->Auth->allow(['gallery'])
在控制器的beforeFilter方法中。
单击导航栏时使用 cakephp 3.7 新 url 添加到参数的查询字符串中,这是结果
Link 应该将用户重定向到
http://merchant1.com/users/gallery
但实际上在它下面的浏览器地址栏中,重定向到
http://merchant1.com/users/merchant?redirect=%2Fhqusers%2Fgallery
这里是$this->request->params的调试结果
Array (
[controller] => users
[action] => merchant
[pass] => Array
(
)
[plugin] =>
[_matchedRoute] => /:controller/:action/*
[?] => Array
(
[redirect] => /users/gallery
)
[_ext] =>
[isAjax] =>
)
下面是授权配置
$this->Auth->config([
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'email',
'password' => 'password'
],
'userModel' => 'Users'
]
],
'loginAction' => [
'controller' => 'users',
'action' => 'login'
],
'loginRedirect' => [
'controller' => 'users',
'action' => 'login'
],
'logoutRedirect' => [
'controller' => 'users',
'action' => 'logout'
],
'storage' => [
'className' => 'Session',
'key' => 'Auth.users'
]
]);
这里有什么问题。
找到上述问题的解决方案
我必须更换
$this->Auth->allow('gallery')
到
$this->Auth->allow(['gallery'])
在控制器的beforeFilter方法中。