简体   繁体   English

Yii触发行动

[英]Yii make trigger for actions

Is any way to do something like that: Triggers on action, that runnings before or after action, and in other folder. 有什么办法可以做这样的事情:触发动作,在动作之前或之后运行以及在其他文件夹中运行。 For example folder protected/triggers/CMainController.php function actionAfterIndex() { ... } Will calls after main action. 例如,文件夹protected / triggers / CMainController.php函数actionAfterIndex(){...}将在主操作之后调用。

There are methods in CController for beforeAction() and afterAction() . CController中有一些用于beforeAction()afterAction()的方法 You're also able to determine the current action with their $action parameter. 您还可以使用其$ action参数确定当前操作。

protected boolean beforeAction(CAction $action)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM