我有一個名爲PanelAdmin的管理員面板插件。 這是CategoriesController.php如何從cakephp 3中的URL調用插件控制器3
<?php
namespace PanelAdmin\Controller;
use Cake\Controller\Controller;
use Cake\ORM\TableRegistry;
class CategoriesController extends AppController
{
public function initialize()
{
parent::initialize();
$this->loadComponent('Flash'); // Include the FlashComponent
}
public function index()
{
$this->set('topics', $this->categories->find('all'));
}
}
?>
這是主題視圖模板/主題/ index.ctp內
<h1>Blog topics</h1>
<p><?= $this->Html->link('Add Topic', ['action' => 'add']) ?></p>
<table>
<tr>
<th>Id</th>
<th>Title</th>
<th>Created</th>
<th>Actions</th>
</tr>
我想直接調用PanelAdmin,它應該表現出上述觀點,但現在我得到了以下錯誤:
Error: CategoriesController could not be found.
它,它在主src文件夾中搜索我希望它搜索到插件文件夾時,我打http://localhost/multi_shopping/PanelAdmin這個網址。
這在加入plugin PanelAdmin的routes.php文件或主routes.php文件中 – user3653474