yii\helpers\BaseHtml::csrfMetaTags PHP Method

csrfMetaTags() public static method

Generates the meta tags containing CSRF token information.
See also: Request::enableCsrfValidation
public static csrfMetaTags ( ) : string
return string the generated meta tags
    public static function csrfMetaTags()
    {
        $request = Yii::$app->getRequest();
        if ($request instanceof Request && $request->enableCsrfValidation) {
            return static::tag('meta', '', ['name' => 'csrf-param', 'content' => $request->csrfParam]) . "\n    " . static::tag('meta', '', ['name' => 'csrf-token', 'content' => $request->getCsrfToken()]) . "\n";
        } else {
            return '';
        }
    }