Yii Framework v1.1.10 绫诲弬鑰

CInlineAction

system.web.actions
缁ф壙 class CInlineAction » CAction » CComponent
瀹炵幇 IAction
婧愯嚜 1.0
鐗堟湰 $Id: CInlineAction.php 3137 2011-03-28 11:08:06Z mdomba $
婧愮爜 framework/web/actions/CInlineAction.php
CInlineAction琛ㄧず涓涓瀹氫箟鍦ㄦ帶鍒跺櫒涓殑鍔ㄤ綔銆

鏂规硶鍚嶇被浼间簬鈥檃ctionXYZ鈥橈紝杩欓噷鈥橷YZ鈥樹唬琛ㄥ姩浣滃悕绉般

鍏叡灞炴

闅愯棌缁ф壙灞炴

灞炴绫诲瀷鎻忚堪瀹氫箟鍦
controller CController 鎷ユ湁杩欎釜鍔ㄤ綔鐨勬帶鍒跺櫒銆 CAction
id string 鍔ㄤ綔鐨処D銆 CAction

鍏叡鏂规硶

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
__call() 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 CComponent
__construct() 鏋勯犳柟娉曘 CAction
__get() 杩斿洖涓涓睘鎬у笺佷竴涓簨浠跺鐞嗙▼搴忓垪琛ㄦ垨涓涓涓哄悕绉般 CComponent
__isset() 妫鏌ヤ竴涓睘鎬ф槸鍚︿负null銆 CComponent
__set() 璁剧疆涓涓粍浠剁殑灞炴у笺 CComponent
__unset() 璁剧疆涓涓粍浠剁殑灞炴т负null銆 CComponent
asa() 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° CComponent
attachBehavior() 闄勫姞涓涓涓哄埌缁勪欢銆 CComponent
attachBehaviors() 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 CComponent
attachEventHandler() 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 CComponent
canGetProperty() 纭畾灞炴ф槸鍚﹀彲璇汇 CComponent
canSetProperty() 纭畾灞炴ф槸鍚﹀彲鍐欍 CComponent
detachBehavior() 浠庣粍浠朵腑鍒嗙涓涓涓恒 CComponent
detachBehaviors() 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 CComponent
detachEventHandler() 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 CComponent
disableBehavior() 绂佺敤涓涓檮鍔犺涓恒 CComponent
disableBehaviors() 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
enableBehavior() 鍚敤涓涓檮鍔犺涓恒 CComponent
enableBehaviors() 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
evaluateExpression() 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 CComponent
getController() 杩斿洖鎷ユ湁杩欎釜鍔ㄤ綔鐨勬帶鍒跺櫒銆 CAction
getEventHandlers() 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 CComponent
getId() 杩斿洖鍔ㄤ綔鐨処D銆 CAction
hasEvent() 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 CComponent
hasEventHandler() 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 CComponent
hasProperty() 纭畾灞炴ф槸鍚﹁瀹氫箟銆 CComponent
raiseEvent() 鍙戣捣涓涓簨浠躲 CComponent
run() 鎵ц璇ュ姩浣溿 CInlineAction
runWithParams() 鎵ц甯︽彁渚涚殑璇锋眰鐨勫弬鏁扮殑鍔ㄤ綔銆 CInlineAction

鍙椾繚鎶ゆ柟娉

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
runWithParamsInternal() 鎵ц涓涓甫鏈夊懡鍚嶅弬鏁扮殑瀵硅薄鐨勬柟娉曘 CAction

鏂规硶璇︾粏

run() 鏂规硶
public void run()
婧愮爜锛 framework/web/actions/CInlineAction.php#29 (鏄剧ず)
public function run()
{
    
$method='action'.$this->getId();
    
$this->getController()->$method();
}

鎵ц璇ュ姩浣溿 璇ュ姩浣滃畾涔夊湪鎺у埗鍣ㄤ腑琚彂璧枫 杩欎釜鏂规硶闇瑕CAction瑕佹眰瀹炵幇鐨勩

runWithParams() 鏂规硶 锛堝彲鐢ㄨ嚜 v1.1.7锛
public boolean runWithParams(array $params)
$params array 璇锋眰鍙傛暟锛堥敭鍚=>閿硷級
{return} boolean 鍛藉悕鍙傛暟鏄惁鏈夋晥鐨
婧愮爜锛 framework/web/actions/CInlineAction.php#42 (鏄剧ず)
public function runWithParams($params)
{
    
$methodName='action'.$this->getId();
    
$controller=$this->getController();
    
$method=new ReflectionMethod($controller$methodName);
    if(
$method->getNumberOfParameters()>0)
        return 
$this->runWithParamsInternal($controller$method$params);
    else
        return 
$controller->$methodName();
}

鎵ц甯︽彁渚涚殑璇锋眰鐨勫弬鏁扮殑鍔ㄤ綔銆 杩欎釜鏂规硶閫氳繃CController::runAction()鍐呴儴璋冪敤銆

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.