CakePHP plugin throws quot;Missing Viewquot; error but view file exits(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
这是一个常见的错误.
这篇关于CakePHP 插件抛出“Missing View"错误但查看文件退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:CakePHP 插件抛出“Missing View"错误但查看文件退


基础教程推荐
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- php中的foreach复选框POST 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php中的PDF导出 2022-01-01