罪と罰++二律背反

  • include_path = ".:/usr/local/ZendFramework/library"
  • 【application】
       +--【controllers】
       |     ■IndexController.php
       |     ■ErrorController.php
       +--【models】
       +--【views】
             +--【scripts】
                   ■index.phtml
    【public_html】
          ■.htaccess
          ■index.php
RewriteEngine on
; トップページを指定します。
RewriteBase /
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
ln -s /etc/apache2/mod_avaliable/rewrite.load /etc/apache2/enable/
http://FQDN/コントローラ名/アクション名/パラメータ1/値1/パラメータ2/値2
<?php
require_once 'Zend/Controller/Action.php';

class IndexController extends Zend_Controller_Action
{
    public function indexAction()
    {
        // デフォルトアクション
    }
    
    // 存在しないアクションが指定された場合、デフォルトアクションへリダイレクト
    public function __call($method, $args)
    {
        if ('Action' == substr($method, -6))
        {
            $controller = $this->getRequest()->getControllerName();
            $url = '/' . $controller . '/idnex';
            return $this->_redirect($url);
        }
    }
}
<?php
require_once 'Zend/Controller/Front.php';

Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
Zend_Controller_Front::run('../application/controllers');
  • require_once 'Zend/Controller/Action.php';
    
    class ErrorController extends Zend_controller_Action
    {
        public function errorActin()
        {
            // エラーメッセージ
            $response = $this->getResponse();
            $resposen->setBody('コントローラが見つかりません');
        }
    }
  • $this->_forward('hoge', 'fuga');
  • return $this->_forward('hoge', 'fuga');
  • <html>
    <body>
    <?php foreach ($this->person as $value): ?>
    <span><?php echo $this->escape($value['namae']); ?></span><br/>
    <?php endforeach ?>
    </body>
    </html>
  • requre_once 'Zend/View.php';
    
    public function IndexAction()
    {
        $data = array(
            array(
                'namae' => '名前A'
            ),
            array(
                'namae' => '名前B'
            ),
            array(
                'namae' => '名前C'
            )
        );
        $view = new Zend_View();
        $view->setScriptPath('../application/views');
        $view->person = $data;
    
        echo $view->render('sampleview.php')
    }
  • /**
     * 簡単な説明
     * 詳しい説明
     * LICENSE:
     * @copyright
     * @license
     * @version
     * @since
     */

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2012-06-08 (金) 00:24:26 (4341d)