ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

php – Zend_Navigation无法加载

2019-06-27 03:17:50  阅读:198  来源: 互联网

标签:php zend-framework zend-navigation


继我早期的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:\www\mysite\development\website\library\Zend\Navigation\Page.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文档中的哪一个.修复后再次删除此行!

标签:php,zend-framework,zend-navigation
来源: https://codeday.me/bug/20190627/1300331.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有