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表示一个被定义在控制器中的动作。

方法名类似于’actionXYZ‘,这里’XYZ‘代表动作名称。

公共属性

隐藏继承属性

属性类型描述定义在
controller CController 拥有这个动作的控制器。 CAction
id string 动作的ID。 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() 计算一个PHP表达式,或根据组件上下文执行回调。 CComponent
getController() 返回拥有这个动作的控制器。 CAction
getEventHandlers() 返回一个事件的附加处理程序列表。 CComponent
getId() 返回动作的ID。 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.