文件结构
--phproot
----app_zx
------controllers
--------(f)IndexController.php
------models
------views
----library
------zend
----zx
------(f)index.php
------(f).haccess
文件内容:
(1)index.php
<?php
error_reporting(E_ALL|E_STRICT);
//设定时区
date_default_timezone_set('Asia/Shanghai');
//指明引用文件的路径
set_include_path('.' .
PATH_SEPARATOR . '../library/'.
PATH_SEPARATOR . '../app_zx/models/'.
PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php";
Zend_Loader::registerAutoload();
$fc = Zend_Controller_Front::getInstance();
$fc->setControllerDirectory(array(
"default"=>'../app_zx/controllers',
));
$fc->throwExceptions(true);
$fc->setParam('noViewRenderer', true);
$fc->setParam('noErrorHandler', false);
//开始运行程序
$fc->dispatch();
?>
(2).haccess
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
(3) IndexController.php
<?php
class IndexController extends Zend_Controller_Action
{
function indexAction()
{
echo "Hello!";
}
function otherAction()
{
echo "other Action.";
}
}
?>