php – Zend_Navigation无法加载
发布时间:2020-12-13 17:02:59 所属栏目:PHP教程 来源:网络整理
导读:继我早期的 question之后,我仍然遇到将xml文件加载到Zend_Navigation中的问题. 我现在收到以下错误消息: bFatal error/b: Uncaught exception 'Zend_Navigation_Exception' with message 'Invalid argument: Unable to determine class to instantiate' in
继我早期的
question之后,我仍然遇到将xml文件加载到Zend_Navigation中的问题.
我现在收到以下错误消息: <b>Fatal error</b>: Uncaught exception 'Zend_Navigation_Exception' with message 'Invalid argument: Unable to determine class to instantiate' in C:wwwmysitedevelopmentwebsitelibraryZendNavigationPage.php:223 我试图使我的navigation.xml文件看起来类似于Zend Documentation上的示例,但是我似乎无法让它工作.我的XML文件如下所示: <?xml version="1.0" encoding="UTF-8"?> <configdata> <navigation> <default> <label>Home</label> <controller>index</controller> <action>index</action> <module>default</module> <pages> <tour> <label>Tour</label> <controller>tour</controller> <action>index</action> <module>default</module> </tour> <blog> <label></label> <uri>http://blog.mysite.com</uri> </blog> <support> <label>Support</label> <controller>support</controller> <action>index</action> <module>default</module> </support> </pages> </default> <users> <label>Home</label> <controller>index</controller> <action>index</action> <module>users</module> <role>guser</role> <resource>owner</resource> <pages> <jobmanger> <label>Job Manager</label> <controller>jobmanager</controller> <action>index</action> <module>users</module> <role>guser</role> <resource>owner</resource> </jobmanger> <myaccount> <label>My Account</label> <controller>profile</controller> <action>index</action> <role>guser</role> <resource>owner</resource> <module>users</module> <pages> <detail> <label>Account Details</label> <controller>profile</controller> <action>detail</action> <module>users</module> <role>guser</role> <resource>owner</resource> <pages> <history> <label>Account History</label> <controller>profile</controller> <action>history</action> <module>users</module> <role>guser</role> <resource>owner</resource> </history> <password> <label>Change Password</label> <controller>profile</controller> <action>changepwd</action> <module>users</module> <role>employer</role> <resource>employers</resource> </password> </pages> </detail> ... </navigation> </configdata> 我将这个xml加载到bootstrap中,如下所示: $configNav = new Zend_Config_Xml('../application/config/navigation.xml','navigation'); $navigation = new Zend_Navigation($configNav); $navView->navigation($navigation); 现在我承认,我完全得到了错误的结论,但很快就没有了想法,这已经是漫长的一周了. 谢谢, 格兰特 解决方法
Zend_Navigation似乎通过检查控制器,操作和模块密钥是否存在来确定是否使用Mvc页面或Uri页面;或者是一把钥匙.如果未满足这些条件,则会生成您报告的错误.您的XML文档中的所有示例都很好,所以我猜想在XML文件中稍后您缺少其中一个页面所需的键之一.例如.你有一个动作和控制器,但没有模块.
如果您无法找到导致问题的原因,我建议通过插入以下内容临时向Zend_Navigation添加调试行: var_dump($options);exit; 进入Zend / Navigation / Page.php第222行.这将打印出导致错误的元素的键,这可以帮助您确定XML文档中的哪一个.修复后再次删除此行! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |