CakePHP 插件抛出“Missing View"错误但查看文件退出
我正在按照 中的说明为我的 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
这是一个常见的错误.
相关文章