gpt4 book ai didi

php - Yii 用户登录重定向过多

转载 作者:搜寻专家 更新时间:2023-10-31 22:07:51 26 4
gpt4 key购买 nike

我在 Yii 中收到太多重定向的错误。

我正在使用 Yii 提供的默认 accessControl 过滤器。

整个应用程序在我使用 WAMP 的本地主机上完美运行。在我上传到登台服务器后问题开始出现。

据我所知,我已经配置了 .htaccess 文件

Options +FollowSymLinks
IndexIgnore */*

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^.*$ /index.php [L]
</IfModule>

如果我尝试打开任何不需要登录的操作,它会顺利打开

public function accessRules()

{

return array(

array('allow', // allow all users to perform 'index' and 'view' actions

'actions' => array('index', 'locationImport', 'contact'),

'users' => array('*'),

),

array('allow', // allow authenticated user to perform 'create' and 'update' actions

'actions' => array('LocationImport'),

'users' => array('@'),

),

array('allow', // allow admin user to perform 'admin' and 'delete' actions

'actions' => array('admin', 'delete'),

'users' => array('admin'),

),

array('deny', // deny all users

'users' => array('*'),

),

);

}

在上面的 Controller 中,触点正在工作。

我的main.php相关

'user' => array(
// enable cookie-based authentication
'allowAutoLogin' => true,
'loginUrl' => array('/useraccount/login'),
'class' => 'CPWebUser',
),

UserAccountController 中的访问规则

 public function accessRules()
{
return array(
array('allow', // allow all users to perform 'register' and 'login' actions
'actions' => array('register', 'login', 'view', 'xxxx', 'xxxx',),
'users' => array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('update', 'logout', 'home', 'changePassword'),
'users' => array('@'),
)
array('deny', // deny all users
'users' => array('*'),
),
);
}

总结一下。完全适用于本地主机。站点 Controller Actioncontact 工作。userAccountController 中的任何操作均无效。甚至没有注册,它重定向到登录。actionLogin 打不开。

最佳答案

已解决:这是一个非常愚蠢的错误。经过几个小时的工作,由于打字错误问题得到解决。

在 linux 上,main.php 配置变得区分大小写,我在 windows 上编程,而它不是。

我的 Controller 是 userAccount 和

'loginUrl' => array('useraccount/login'),

刚改成

'loginUrl' => array('userAccount/login'),

关于php - Yii 用户登录重定向过多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16013908/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com