我有一个名为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