Yii2设置网页标题
在Yii2中,页面标题是View类的一个公有成员(public)变量$title。
要设置页面标题,首先在Controller/Action中设置$title的值,
TestController { public funtion actionIndex() { ... $this->getView()->title = "your title"; return $this->render("index"); } }
然后可以在layout中设置页面标题:
<title><?= Html::encode($this->title)."-踏得网云开发平台" ?></title>
by iefreer
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: YII2如何修改默认控制器/方法
- 下一篇: windows yii2 advanced默认登录配置