[英]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.