Yii2 注册 link 和 meta 标签


$this->registerLinkTag($option,$key=null);  // 注册 link 标签
$this->registerMetaTag($option,$key=null);  // 注册 meta 标签 

例如:

$this->registerLinkTag(['rel'=>'shortcut icon', 'href'=>Yii::getAlias('@web') . '/favicon.ico']);
//<link href="/advanced/favicon.ico" rel="shortcut icon">

$this->registerMetaTag(['name'=>'author', 'content'=>'张墨轩']);
//<meta name="author" content="张墨轩">