模板的标题问题

新手提问 · ppker · 于 7年前 发布 · 4153 次阅读
<head>
    <meta charset="<?= Yii::$app->charset ?>"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    
    <title><?= Html::encode($this->title) ?> - <?= \Yii::$app->setting->get('siteTitle') ?></title>
    <meta name="keywords" content="<?= \Yii::$app->setting->get('siteKeyword') ?>"/>
    <?php $this->head() ?>
</head>

这个 $this->title 这个title 是在代码的哪儿设置的呢?

共收到 3 条回复 模板
forecho#17年前 0 个赞

你这个是 layout 文件,对应的 $this->title 要到具体的视图文件设置。

views 文件夹下面,除了 layout\main.php 文件,你看看其他文件就知道了。

ppker#27年前 0 个赞

@forecho #1楼 是的 看到了 哈哈谢谢

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册