项目结构:
ZF
application
moldes
default
controllers
models
views
scripts
product
controllers
models
views
scripts
lib
Zend
public
filters
javascript
helpers
index.php:
<?php
error_reporting(E_ALL|E_STRICT);//开启错误报告
date_default_timezone_set('Asia/Shanghai');//配置地区
set_include_path('.' .PATH_SEPARATOR .'./library'.PATH_SEPARATOR .'./application/models/'.PATH_SEPARATOR . get_include_path());//配置环境目录
require_once "library/Zend/Loader/Autoloader.php"; //载入zend框架
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true); //静态载入自动类文件
$registry = Zend_Registry::getInstance();//静态获得实例
$view = new Zend_View();//实例化zend 模板
$view->setScriptPath('./application/modules/default/views/scripts/');//设置模板显示的路径
$view->addScriptPath('./application/modules/product/views/scripts/');
$registry['view'] = $view;//注册View
//设置控制器
$frontController =Zend_Controller_Front::getInstance();
$frontController->setBaseUrl('/zendf')//设置基本路径
->setParam('noViewRenderer', true)
->setParam('useDefaultControllerAlways', true)
->addModuleDirectory('./application/modules')
->throwExceptions(true)
->dispatch();