当我将我的zend框架应用程序从windows(zf 1.10.3)传输到linux(zf.10.7)时 一些控制器工作正常,但有些 显示此异常
Fatal error: Undefined class constant 'EXCEPTION_NO_ROUTE' in /path/to/application/modules/default/controllers/ErrorController.php on line 11
/ controllers
VideoController.php
/视图
/脚本
/视频
index.phtml
VideoController.php
class VideoController extend Zend_Controller_Action
{
public indexAction(){}
}
Weacan没有正确吗?
答案 0 :(得分:1)
解决
只需在默认错误控制器case:NO_ROUTE
答案 1 :(得分:0)
我必须添加到文件Zend/Controller/Plugin/ErrorHandler.php
在第50行附近,定义了其他异常类型。我在文件中添加了以下内容:
/**
* Const - No Route Exception; cannot find route to target
*/
const EXCEPTION_NO_ROUTE = 'EXCEPTION_NO_ROUTE';
不确定为什么在框架中使用它,但未定义...
答案 2 :(得分:0)
我确实遇到了这个问题,这是因为我的机器上安装了两个zend-framework。 Zend-frameworks基本上包含两部分:
如果您使用znd-command来自zend的不同版本/安装/ ...而不是通过php-configuration中的include_path可用的类,则zf命令创建的文件可能存在不兼容的风险。它们具有不相容的含义,它们假设某一类具有某种蓝图。在这种情况下,这个假设当然很容易被打破。
要解决此问题,请在linux / osx上找到zf-command的安装位置:
justin:~ herbert$ which zf
/usr/share/zend-framework/bin//zf
justin:~ herbert$
Windows上的:使用Windows资源管理器和搜索(随意评论更好的方式,我是一个windows-noknowhow)
在你的搜索中非常糟糕!也许'哪个'告诉你你的可执行文件在'/ usr / bin / zf'中,但这可能是一个符号链接。按照它找到真实的位置。
所以在我的情况下它位于/ usr / share / zend-framework / bin /,然后zf的Zend安装位于/ usr / share / zend-framework /(可能,我不知道是否发行版就像ubuntu一样混乱了。)
无论如何,你的项目使用的php文件位于/ usr / share / zend-framework / library /(所以库子目录)。通过编辑你的php.ini(/ etc / ... /php.ini)告诉你的php:
include_path = "/usr/share/zend-framework/library/"
最终重新启动你的apache
apachectl restart
注:
如何查找Zend框架的多个安装:
justin:~ herbert$ updatedb (or on osx: /usr/libexec/locate.updatedb)
justin:~ herbert$ locate Zend/Application.php
Zend / Application.ini'的任何目录都可能是Zend框架;)