PHP 8.3.0 RC 6 available for testing

Yaf_Action_Abstract::execute

(Yaf >=1.0.0)

Yaf_Action_Abstract::execute动作入口点

说明

abstract publicYaf_Action_Abstract::execute(mixed ...$args): mixed

用户应该始终为动作定义此方法,这是动作的入口点。Yaf_Action_Abstract::execute() 可能会有参数。

注意:

从请求中获取值不安全,在使用之前需要对其过滤。

参数

args

返回值

示例

示例 #1 Yaf_Action_Abstract::execute() 示例

<?php
/**
* A controller example
*/
class ProductController extends Yaf_Controller_Abstract {
protected
$actions = array(
"index" => "actions/Index.php",
);
}
?>

示例 #2 Yaf_Action_Abstract::execute() 示例

<?php
/**
* ListAction
*/
class ListAction extends Yaf_Action_Abstract {
public function
execute ($name, $id) {
assert($name == $this->getRequest()->getParam("name"));
assert($id == $this->getRequest()->getParam("id"));
}
}
?>

以上示例的输出类似于:

 
/**
 * Now assuming we are using the Yaf_Route_Static route 
 * for request: http://yourdomain/product/list/name/yaf/id/22
 * will result:
 */
 bool(true)
 bool(true)

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top