Home >Backend Development >PHP Tutorial >zend framework 一个简单的路径有关问题

zend framework 一个简单的路径有关问题

WBOY
WBOYOriginal
2016-06-13 09:59:40817browse

zend framework 一个简单的路径问题
require_once APPLICATION_PATH . '/modules/admin/models/Login.php';这句话,我在controller类里真是用到吐血了,不用不行,找不到model类。
新人求告各位大侠,怎么设置可以不用再加这句话

------解决方案--------------------
zf默认是可以找到model的呀
------解决方案--------------------
为什么要用require_once呢?难道不能用zendframework的自动加载功能。比你这个好多了。
------解决方案--------------------
这是一个最简单的index.php的配置,你参考一下吧

PHP code
<?php // Define path to application directorydefined('APPLICATION_PATH')    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));// Define application environmentdefined('APPLICATION_ENV')    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));// Ensure library/ is on include_pathset_include_path(implode(PATH_SEPARATOR, array(    realpath(APPLICATION_PATH . '/../library'),    get_include_path(),)));/** Zend_Application */require_once 'Zend/Application.php';  /** Load Layout  */require_once 'Zend/Layout.php';Zend_Layout::startMvc(array('layoutPath'=>'../application/layouts',));// Create application, bootstrap, and run$application = new Zend_Application(    APPLICATION_ENV,     APPLICATION_PATH . '/configs/application.ini');$application->bootstrap()            ->run();<div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn