4,250
社区成员
发帖
与我相关
我的任务
分享
# Zend Framework rewrite规则
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
# 安全性考虑:不允许列表目录内容
Options -Indexes
# PHP设置
php_flag magic_quotes_gpc off
php_flag register_globals off
php_flag short_open_tag on
<?php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1);
date_default_timezone_set('Europe/London');
// 目录设置和类装载
set_include_path('.' . PATH_SEPARATOR . '../library/'
. PATH_SEPARATOR . '../application/models'
. PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php";
Zend_Loader::registerAutoload();
// 设置控制器
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->setControllerDirectory('../application/controllers');
// run!
$frontController->dispatch();
<?php
class IndexController extends Zend_Controller_Action
{
function indexAction()
{
$this->view->title ='My123 Album';
}
function addAction()
{
$this->view->title ='Add Album';
}
function editAction()
{
$this->view->title ='Edit Album';
}
function deleteAction()
{
$this->view->title ='Delete Album';
}
}
<html>
<head>
<title><?php echo $this->escape($this->title);?></title>
</head>
<body>
<h1><?php echo $this->escape($this->title);?></h1>
</body>
</html>
<html>
<head>
<title><?php echo $this->escape($this->title);?></title>
</head>
<body>
<h1><?php echo $this->escape($this->title);?></h1>
</body>
</html>