本文整理汇总了PHP中yii\web\Controller::afterAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::afterAction方法的具体用法?PHP Controller::afterAction怎么用?PHP Controller::afterAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\web\Controller
的用法示例。
在下文中一共展示了Controller::afterAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterAction
/**
* @inheritdoc
*/
public function afterAction($action, $result)
{
if ($this->_oldMailPath !== null) {
Yii::$app->getMailer()->setViewPath($this->_oldMailPath);
}
return parent::afterAction($action, $result);
}
示例2: afterAction
public function afterAction($action, $result)
{
if (self::$isStatistic) {
(new Query())->createCommand()->insert('timer', ['action_id' => $action->id, 'controller_id' => $this->id, 'date_time' => gmdate('YmdHis'), 'timer' => microtime(true) - $this->markDownCounter])->execute();
}
return parent::afterAction($action, $result);
}
示例3: afterAction
/**
* @param \yii\base\Action $action
* @param mixed $result
* @return mixed
*/
public function afterAction($action, $result)
{
if ($this->session->isActive) {
$this->session->close();
}
return parent::afterAction($action, $result);
}
示例4: afterAction
public function afterAction($action, $result)
{
echo 'before action<br>';
echo 'test<br>';
return parent::afterAction($action, $result);
// TODO: Change the autogenerated stub
}
示例5: afterAction
public function afterAction($action, $result)
{
$result = parent::afterAction($action, $result);
if ($action->id != 'error' && Extension_Loaded('zlib')) {
Ob_End_Flush();
}
return $result;
}
示例6: afterAction
public function afterAction($action, $result)
{
parent::afterAction($action, $result);
if (Yii::$app->response->format == Response::FORMAT_JSON) {
header('Content-Type: application/json');
return $this->ajaxResponse;
}
return null;
}
示例7: afterAction
/**
* @inheritdoc
*/
public function afterAction($action, $result)
{
// save log
$log = new models\api\Log();
$log->status = models\api\Log::STATUS_SUCCESS;
$log->save();
// generate answer
$data = ['status' => models\api\Log::STATUS_SUCCESS, 'data' => $result];
return parent::afterAction($action, $data);
}
示例8: afterAction
public function afterAction($action, $result)
{
$result = parent::afterAction($action, $result);
// your custom code here
$obResult = ob_get_clean();
if (!empty($obResult)) {
// 所有actionXxx中 如果出现 echo print dump 等向缓存输出内容的调用 将走此逻辑
return $this->renderContent($obResult);
// return $obResult ;
}
return $result;
}
示例9: afterAction
/**
* Executed after action
* @author Adegoke Obasa <goke@cottacush.com>
* @param \yii\base\Action $action
* @param mixed $result
* @return mixed
*/
public function afterAction($action, $result)
{
$result = parent::afterAction($action, $result);
$this->setSecurityHeaders();
/**
* Set Current Transaction in New Relic
* @author Adegoke Obasa <goke@cottacush.com>
*/
if (extension_loaded('newrelic')) {
newrelic_name_transaction($action->controller->id . '/' . $action->id);
}
return $result;
}
示例10: afterAction
/**
* @inheritdoc
*/
public function afterAction($action, $result)
{
$result = parent::afterAction($action, $result);
if ($result) {
return $result;
}
$session = Yii::$app->session;
if ($session->isActive) {
$session->close();
}
$this->view->registerAssetBundle($this->assetName);
$this->data('tpl', $this->_tpl . '.tpl');
$this->forceSetTitle();
return $this->renderPartial('@app/views/index.tpl', $this->_data);
}
示例11: afterAction
public function afterAction($action, $result)
{
/**
* @var $user \common\models\User
*/
if (!\Yii::$app->user->isGuest) {
$user = \Yii::$app->user->identity;
// если у пользователя изменили данные и не сохранили, то сохраняем,
// один из вариантов обновления без сохранения смотреть в методе чуть выше beforeAction
if ($user->getDirtyAttributes()) {
$user->update();
}
}
return parent::afterAction($action, $result);
// TODO: Change the autogenerated stub
}
示例12: afterAction
public function afterAction($action, $result)
{
$errorHandler = Yii::$app->get('errorHandler');
if (!empty($errorHandler->exception)) {
$this->handleException($errorHandler->exception);
}
$result = parent::afterAction($action, $result);
if ($this->response->getStatusCode() == 200) {
return $this->respondByFormat();
}
return $result;
}
示例13: afterAction
public function afterAction($action, $result)
{
U::W("{$this->id}/{$this->action->id}:" . Yii::getLogger()->getElapsedTime());
return parent::afterAction($action, $result);
}
示例14: afterAction
/**
* @inheritdoc
*/
public function afterAction($action, $result)
{
\Yii::endProfile('jsonrpc.controller.' . $action->id);
return parent::afterAction($action, $result);
}
示例15: afterAction
/**
* @inheritdoc
*/
public function afterAction($action, $result)
{
$result = parent::afterAction($action, $result);
return $this->serializeData($result);
}