歡迎光臨, 訪客. 請先 登入註冊一個帳號.
三月 29, 2024, 07:10:17 下午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  核心補強  |  perform()方法是在哪调用的 « 上篇主題 下篇主題 »
頁: [1]
作者 主題: perform()方法是在哪调用的  (閱讀 13667 次)
robin
新手見習
*
文章: 35


檢視個人資料
« 於: 八月 01, 2007, 02:37:17 下午 »

------------------------------
<?php

   lt_include( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" );
    lt_include( PLOG_CLASS_PATH."class/summary/view/summaryaskquestionview.class.php" );       

   /**
    * shows a list with all the users, pager included
    */
     class AskQuestionAction extends SummaryAction
     {
        function AskQuestionAction( $actionInfo, $request )
        {
            $this->SummaryAction( $actionInfo, $request );
        }
      
        /**
         * Loads the posts and shows them.
         */
        function perform()
        {
         $this->_view = new SummaryAskQuestionView( Array( "summary" => "AskQuestion",
                                                        "locale" => $this->_locale->getLocaleCode()));
         if( $this->_view->isCached()) {
            // nothing to do, the view is cached
            $this->setCommonData();
            return true;
         }
         
         $this->setCommonData();
         
         return true;
      }
     }   
?>
-----------------------------------
很想知道这个perform()方法是在哪调用的,它不是类的同名方法,也不是构造方法,但是会每次都执行,一直找不到它是在哪里调用的,只看到在ACTION类的定义过一个空方法。请指点一下,谢谢!
已記錄
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #1 於: 八月 01, 2007, 03:28:40 下午 »

這是在 controller.php 中調用的。

在 MVC 的架構中, Controller (Front Controller) 是用來控制要執行哪一支 Acton (Action Controller) 的程式,所以 controller 他會去啟始這個 Action 的 object 外,他還會執行這個 Action 所以備呼叫後所需要執行的工作,這個就是 perform()。

你可以看看 controller.php,就會看到 perform() 的調用了。

Mark
已記錄

頁: [1]
LifeType 中文開發論壇  |  開發  |  核心補強  |  perform()方法是在哪调用的 « 上篇主題 下篇主題 »
    前往: