我想在导航栏中添加一个按钮,以便重定向到index.php。请帮我完成任务。我想重定向到以下网址
http://localhost/Backup/web/index.php
我尝试下面的代码,
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'encodeLabels' => false,
'items' => [
['label' => 'ContactUs', 'url' => ['index.php']],
],
]);
答案 0 :(得分:0)
试试这个
'url'=> Yii::$app->homeUrl
答案 1 :(得分:0)
试试这个:
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'encodeLabels' => false,
'items' => [
['label' => 'ContactUs', 'url' => ['web/index']],
],
]);