zend framework 学习笔记(1)之Hello

文件结构
--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.";

      }

    }

    ?>

 

posted @ 2009-05-17 20:01  zx  阅读(308)  评论(1编辑  收藏  举报