本文整理汇总了PHP中yii\base\ActionFilter::afterAction方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionFilter::afterAction方法的具体用法?PHP ActionFilter::afterAction怎么用?PHP ActionFilter::afterAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\ActionFilter
的用法示例。
在下文中一共展示了ActionFilter::afterAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterAction
public function afterAction($action, $result)
{
$res = parent::afterAction($action, $result);
if ($this->ajaxMode) {
if ($res) {
$dom = Yii::createObject(['class' => Dom::className(), 'html' => $res]);
if (!empty($_REQUEST['target_id'])) {
$target_id = explode(',', $_REQUEST['target_id']);
$this->ajaxVars['html'] = $dom->getElementByIds($target_id);
}
list($scripts, $src) = $dom->getScripts();
if ($scripts) {
$this->ajaxVars['scripts'] = $scripts;
}
if ($src && 0) {
// disabled
$this->ajaxVars['scripts_src'] = $src;
}
}
// Flashes
if (!isset($this->ajaxVars['alerts'])) {
$this->ajaxVars['alerts'] = Yii::$app->session->getAllFlashes();
}
Yii::$app->response->format = 'json';
return $this->ajaxVars;
}
return $res;
}
示例2: afterAction
/**
* This method is invoked right after an action is executed.
* You may override this method to do some postprocessing for the action.
* @param Action $action the action just executed.
* @param mixed $result the action execution result
* @return mixed the processed action result.
*/
public function afterAction($action, $result)
{
$usedTime = microtime(TRUE) - $this->_startTime;
$logContent = "Action:'{$action->uniqueId}' spent {$usedTime} seconds";
$appLog = new AppLog(['log_content' => $logContent]);
$appLog->save();
return parent::afterAction($action, $result);
}
示例3: afterAction
public function afterAction($action, $result)
{
return parent::afterAction($action, $result);
}
示例4: afterAction
public function afterAction($action, $result)
{
$time = microtime(true) - $this->_startTime;
Yii::trace("Action '{$action->uniqueId}' spent {$time} second.");
return parent::afterAction($action, $result);
}
示例5: afterAction
/**
* @inheritdoc
*/
public function afterAction($action, $result)
{
$parentsResults = parent::afterAction($action, $result);
Url::rememberStack();
return $parentsResults;
}