我正在蛋糕2.x中开发自定义插件,但我无法使用它访问它

发布于 2025-01-26 05:42:24 字数 634 浏览 3 评论 0原文

我使用了用食谱中编写的文档创建了插件。

蛋糕烘焙插件mytool

,它确实可以在应用程序插件文件夹中创建一个名为MyTool的插件。 现在使用命令创建一个控制器。

Cake Bake Controller测试 - Plugin MyTool

它在应用程序插件控制器文件夹中创建了一个新的控制器,然后我在应用程序插件config Routes.php File.php文件中创建了

Router :: Connect('/////// testing',array('plugin'=>'recontool',“控制器” =>'tests','action'=>'index'));

加载了此插件

然后我使用command cakeplugin :: load(['recontool'=> ['routes'=> true]]);

在应用程序配置bootstrap.php中,成功加载了插件。 但是,当我试图访问插件的路由时,它不起作用,但是找不到 recontoolController的错误。

我必须在Cake PHP版本2中这样做

I have created plugin using it's documentation written in Cookbook.

cake bake plugin Mytool

And it does fine created a plugin named Mytool inside the app plugin folder.
Now created a controller using command.

cake bake controller Tests --plugin Mytool

It created a new controller inside the app plugin controller folder and then I created routes inside app plugin config routes.php file as

Router::connect('/testing', array('plugin' => 'recontool', 'controller' => 'tests', 'action' => 'index'));

Then I loaded this plugin using command

CakePlugin::load(['Recontool' => ['routes' => true]]);

Inside the app config bootstrap.php, and plugin loaded successfully.
But when I am trying to access the routes of the plugin it does not work but only shows error of RecontoolController could not be found..

I have to do this in cake PHP version 2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离旧人 2025-02-02 05:42:24

在routes.php文件中;您正在定义错误的路线。您的插件名称和控制器名称在您的路线中不合适。

这应该是您的正确路线。如果您的插件名称为myTool,而控制器名称为testscontroller

Router::connect('/testing', array('plugin' => 'Mytool', 'controller' => 'Tests', 'action' => 'index'));

In routes.php file; you are defining wrong routes. Your Plugin name and Controller name is not proper in your route.

This should be your correct route. If your plugin name is Mytool and controller name is TestsController.

Router::connect('/testing', array('plugin' => 'Mytool', 'controller' => 'Tests', 'action' => 'index'));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文