我正在按照 中的说明为我的 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"错误但查看文件退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
不能使用 'Object 作为类名,因为它是保留的Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作为类名,因为它是保留的 Cake 2.2.x)
OAuth 重定向后会话丢失Session is lost after an OAuth redirect(OAuth 重定向后会话丢失)
Cakephp 3.x 中的分页排序Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分页排序)
CakePHP 多个应用程序的共享核心CakePHP Shared core for multiple apps(CakePHP 多个应用程序的共享核心)
在 CakePHP 3 上登录 [ Auth->identify() ] 始终为 falLogin [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登录 [ Auth-identify() ] 始终为 false)
致命错误:允许的内存大小为 134217728 字节已用尽Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命错误:允许的内存大小为 134217728 字节已用尽