安裝Zend Framework

參考:http://framework.zend.com/manual/en/zend.controller.html#zend.controller.quickstart

1.下載Zend Framework http://framework.zend.com/download 下載 Zend Framework 1.5.0 Preview Release

2.先建立系統結構

app/
controllers/
IndexController.php
models/
views/
scripts/
index/
index.phtml
helpers/
filters/
html/
.htaccess
index.php
lib/

3
.解壓縮ZendFramework-1.5.0PR.zip將Zend/的目錄移至/lib裡面。

4.編輯/html/.htaccess


RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
php_value include_path ".;\path\to\lib\"


Note
"\path\to\lib" 看你的lib放在伺服器的哪個地方,如果在WINDOWS底下,例如:C\apache\www\lib
就把
"\path\to\lib"換成".;C\apache\www\lib"

相關設定:
  1. http://www.php.net/manual/en/ini.core.php#ini.include-path
  2. http://www.php.net/manual/en/configuration.changes.php
5.編輯html/index.php


require_once 'Zend/Controller/Front.php';
Zend_Controller_Front::run('path\to\app\controllers');
?>
6.編輯app/controllers/IndexController.php
/** Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';
class
IndexController extends Zend_Controller_Action
{
public function
indexAction()
{
}
}
?>
7.編輯
views/scripts/index/index.phtml





My first Zend Framework App


Hello, World!





8.測試 http://localhost/html/ 看網頁有沒有出現Hello Word!就成功拉

熱門文章