Redirect to login page instead of index page in Yii(重定向到登录页面而不是 Yii 中的索引页面)
问题描述
当我进入我的应用程序时,页面被重定向到 Yii 中的索引页面.
When I am going to my application, the page is redirect to the index page in Yii.
根据要求,我想像 /user/login 一样重定向到用户模块的登录页面.
As per requirement, I want to redirect to the login page of the user module just like /user/login.
为此,我已将 sitecontroller 代码索引更改为 user/login,但显示错误.
So for doing that I have changed the sitecontroller code index to user/login, but it showed an error.
有人能告诉我如何默认重定向 user/login 页面而不是索引页面吗?任何帮助和建议都将受到高度赞赏.
Can some one tell me how to redirect the user/login page by default instead of index page? Any help and suggestions will be highly appreciable.
推荐答案
检查 Yii 框架论坛上的这个主题.
复制/粘贴答案(由 jodev 提供):
Copy/paste of the answer (by jodev):
无需扩展任何东西.你所要做的就是敞开心扉protected/config/main.php 并将以下内容添加到配置数组中:
No need to extend anything. All you have to do is open up
protected/config/main.phpand add the following to the config array:
return array(
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
'name' => 'My application',
'defaultController' => 'myController/myAction', // <--- add this line and replace with correct controller/action
这篇关于重定向到登录页面而不是 Yii 中的索引页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:重定向到登录页面而不是 Yii 中的索引页面
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
