Rumah  >  Artikel  >  pembangunan bahagian belakang  >  zend framework 一个简单的路径有关问题

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

WBOY
WBOYasal
2016-06-13 09:59:40791semak imbas

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>
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn