芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/airport-back/vendor/yiisoft/yii2/filters/AjaxFilter.php
'yii\filters\AjaxFilter', * 'only' => ['index'] * ], * ]; * } * ``` * * @author Dmitry Dorogin
* @since 2.0.13 */ class AjaxFilter extends ActionFilter { /** * @var string the message to be displayed when request isn't ajax */ public $errorMessage = 'Request must be XMLHttpRequest.'; /** * @var Request|null the current request. If not set, the `request` application component will be used. */ public $request; /** * {@inheritdoc} */ public function init() { if ($this->request === null) { $this->request = Yii::$app->getRequest(); } } /** * {@inheritdoc} */ public function beforeAction($action) { if ($this->request->getIsAjax()) { return true; } throw new BadRequestHttpException($this->errorMessage); } }