简体   繁体   English

CakePHP的路径路径对流的视图路径或对流错误

[英]CakePHP wrong views path or convections for RoutingAliases

I'm very confused. 我很困惑 I'm using CakePHP 1.2 and try to add this structure: 我正在使用CakePHP 1.2并尝试添加以下结构:

  • DB name: routingaliases 数据库名称:routingaliases
  • Model name: Routingalias, routingalias.php 型号名称:Routingalias,routingalias.php
  • Controller: RoutingaliasesController and var $name = 'Routingaliases';, routingaliases_controller.php 控制器:RoutingaliasesController和var $ name ='Routingaliases';, routingaliases_controller.php
  • Views: folder name - routingaliases and there are index.ctp and main.ctp 视图:文件夹名称-路由别名,并且有index.ctp和main.ctp

But when try to open http://example.com/routingaliases/index I received error: 但是,当尝试打开http://example.com/routingaliases/index时,我收到了错误消息:

Error: The view for RoutingaliasesController::index() was not found. 错误:找不到RoutingaliasesController :: index()的视图。

Error: Confirm you have created the file: /var/www/ * ** /views/routingaliases/index.ctp 错误:确认您已创建文件:/ var / www / * ** /views/routingaliases/index.ctp

Notice: If you want to customize this error message, create * /views/errors/missing_view.ctp 注意:如果要自定义此错误消息,请创建* /views/errors/missing_view.ctp

Actually folder and view file exist, but I got it error. 实际上文件夹和视图文件存在,但是我得到了错误。 Can someone help me how to fix it? 有人可以帮我解决问题吗?

Are you sure the file is readable by your web server? 您确定文件可以被您的Web服务器读取吗? Make sure the view file has the proper permissions (on Linux servers usually www-data or apache user as owner, with chmod 644 permissions). 确保视图文件具有适当的权限(在Linux服务器上,通常是www-data或以所有者为apache用户,并具有chmod 644权限)。

Also try checking your error log for further details (might be worth checking both your web server's error log as well as cake's logs under app/tmp/logs/error.log and debug.log). 也可以尝试检查错误日志以获取更多详细信息(可能值得检查Web服务器的错误日志以及app / tmp / logs / error.log和debug.log下的cake日志)。

Sounds like a problem with your naming, not sure what it is, but why don't you use the CakePHP naming convention? 听起来好像是您的命名有问题,不确定它是什么,但是为什么不使用CakePHP命名约定呢? According to it, you should have: 根据它,您应该具有:

views folder: routing_aliases 视图文件夹:routing_aliases

model: routing_alias.php, class name RoutingAlias 型号:routing_alias.php,类名RoutingAlias

controller: routing_aliases_controller.php, class name RoutingAliasesController, var $name = RoutingAliases 控制器:routing_aliases_controller.php,类名RoutingAliasesController,变量$ name = RoutingAliases

The db table name would be routing_aliases, but if for some reason you don't want to change it you can add in the model var $useTable = 'routingaliases'; 数据库表名称为routing_aliases,但是如果由于某些原因您不想更改它,则可以在模型中添加var $ useTable ='routingaliases';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM