简体   繁体   English

如何解决错误“您真的认为自己可以看到吗”

[英]How do I fix the error “Did you really think you are allowed to see that”

I am fresher in cakephp. 我在cakephp中比较新鲜。 For my current project, I am using CakePHP skeleton app . 对于我当前的项目,我正在使用CakePHP skeleton app Everything going fine. 一切都很好。 But when I am creating new controller for admin panel then it showing this message Did you really think you are allowed to see that? 但是,当我为管理面板创建新控制器时,它会显示此消息Did you really think you are allowed to see that? . Someone please help me. 有人请帮助我。

I am showing my codes below: 我在下面显示我的代码:

Route: 路线:

Router::prefix('admin', function ($routes) {
     // Other routes are here.
     $routes->connect('/sections', ['controller' => 'Sections', 'action' =>'index']);
}

SectionsController.php SectionsController.php

<?php

namespace App\Controller\Admin;

    use App\Controller\AppController;

    class SectionsController extends AppController {

    public function index() {
        echo "I am for sections page";
    }

}

This controller is locate in src\\Controller\\Admin folder 该控制器位于src\\Controller\\Admin文件夹中

Below is my error message. 以下是我的错误消息。

在此处输入图片说明

probably this would be the solution. 可能这将是解决方案。

use Cake\Event\Event;
class YourController extends AppController
{
     public function beforeFilter(Event $event)
     {
         parent::beforeFilter($event);        
         $this->Auth->allow('index');
     }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 你如何解决这个错误mysql - how do you fix this error mysql 如何解决此错误,我收到“抱歉,找不到您要查找的页面。” - How do i fix this error i'm getting “Sorry, the page you are looking for could not be found.” 如何解决这个错误“App\Controller\CoreController”没有设置容器,你是不是忘了将它定义为服务订阅者? - how to fix this error "App\Controller\CoreController" has no container set, did you forget to define it as a service subscriber? 为什么出现此错误:不允许您尝试上传的文件类型 - Why I'm getting this error: The filetype you are attempting to upload is not allowed 我无法登录仪表板,PHP 致命错误,抱歉,不允许您 - I cant login to dashboard, PHP Fatal error, Sorry, You Are Not Allowed 如何消除此错误:不允许您尝试上传的文件类型 - How to remove this error: The filetype you are attempting to upload is not allowed 你看到逻辑错误了吗 - Can you see a logic error 您认为我应该将所有 php 函数保存在一个文件中吗? - do you think i should keep all my php functions in one file? 您如何检查并查看推进对象是否具有i18n记录? - How do you check and see if a propel object has an i18n record? 您如何看待这个关于如何配置开发/登台/生产实例的怪异想法? - What do you think about this weird idea about how to configure development/staging/production instances?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM