dousa2794 2014-07-29 16:48
浏览 21
已采纳

CakePHP缺少ApplicationNameController

I have had installed and configured a new CakePHP 2.4 instance. Now I wanted to implement the AuthComponent. I have had implemented the component exactly as in recent projects, too. Now I have the problem that I get the error message Missing Controller: SteadinessController. But Steadiness is the project name. I'm confused haha.

The URL I want to open is http://localhost/steadiness/users/view/2 and I will be redirected to http://localhost/steadiness/steadiness/users/login. The controller and action invoked is correct but the second steadiness is false.

Thanks a lot for help.

Alex

  • 写回答

1条回答 默认 最新

  • dtqqq24248 2014-07-31 00:29
    关注

    Can you post the code where you try to direct the user to this url?

    I'm guessing it's a redirect to do with the Auth component.

    In your AppController when you set up Auth there should be something similar yo:

    public $components = array(
        'Session',
        'Auth' => array(
            'loginRedirect' => '/',
            'logoutRedirect' => '/',
            'authorize' => 'controller',
            'unauthorizedRedirect' => '/'
        )
    );
    
    1. The loginRedirect tells Cake where to send users after login who went directly to the login page (they didn't try to access a restricted link whilst not logged in).

    2. The logoutRedirect tells Cake where to send users after logout.

    3. The unauthorizedRedirect tells Cake where to send logged in users that try to access a link that they do not have the priveleges for (e.g. a non-admin tries to delete an account - only admins should be able to do that).

    If one of these is not set then when Cake tries to use it you get redirected to '/{app-directory}' which is NOT the same as '/'. This is most likely why your url has the domain appear twice - so Cake thinks it is looking for a controller with the same name as your domain.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案