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 directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); // Ensure library/ is on include_path set_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();