我正在按照 中的说明为我的 cakePHP 2.x 应用程序编写一个基本插件书.
我已经用 MyPluginAppController.php 和 MyPluginAppModel.php 创建了目录/文件结构.
I've created the directory/file structure with a MyPluginAppController.php and MyPluginAppModel.php.
我将 CakePlugin::load('MyPlugin');
添加到父应用程序的 bootstrap.php 文件中.
I added CakePlugin::load('MyPlugin');
to the parent app's bootstrap.php file.
然后我创建了一个控制器和模型.但是由于某种原因,当我尝试查看 mysite.dev/(admin)/my_plugin/my_model/
时,我收到Missing View"错误.它说要确认视图文件存在,确实如此!
Then I created one Controller and Model. But for some reason when I try to view mysite.dev/(admin)/my_plugin/my_model/
I get a "Missing View" error. It says to confirm that the view file exists, which it does!
我认为我没有跳过书中的任何步骤.我做错了什么?
I don't think I skipped any steps from the book. What am I doing wrong?
更新:
控制器路径:app/Plugin/MyPlugin/Controller/MyModelController.php
查看路径:app/Plugin/MyPlugin/View/MyModel/admin_index.php
网址:http://mysite.dev/admin/my_plugin/my_model/
重命名此文件
app/Plugin/MyPlugin/View/MyModel/admin_index.php
到这个扩展.ctp
app/Plugin/MyPlugin/View/MyModel/admin_index.ctp
这是一个常见的错误.
这篇关于CakePHP 插件抛出“Missing View"错误但查看文件退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!