public function actionFavor_articles($id) { User::getUserInfoOrRedirect($this, $id, $user, $isMyProfile); $request = Yii::$app->request; $favor_articles = Blog::getFavoritesArticles($id, 20, $request->post('contentId')); if ($request->isAjax) { echo json_encode(['favor_articles' => $favor_articles]); return; } return $this->render('favor_articles', ['favor_articles' => $favor_articles, 'user' => $user, 'isMyProfile' => $isMyProfile]); }