本文整理匯總了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;
}