求助yii报错

sinat_37552373 2018-08-19 05:37:13
错误信息如下
Unknown Property – yii\base\UnknownPropertyException

Setting unknown property: yii\bootstrap\Dropdown::views
1. in F:\phpStudy\WWW\myblog\vendor\yiisoft\yii2\base\Component.php at line 209
200201202203204205206207208209210211212213214215216217218 $behavior->$name = $value;
return;
}
}

if (method_exists($this, 'get' . $name)) {
throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);
}

throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name);
}

/**
* Checks if a property is set, i.e. defined and not null.
*
* This method will check in the following order and act accordingly:
*
* - a property defined by a setter: return whether the property is set
* - a property of a behavior: return whether the property is set



...全文
317 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sinat_37552373 2018-08-19
  • 打赏
  • 举报
回复
引用 2 楼 xuzuning 的回复:
指出错误行在哪里


<?php
NavBar::begin([
'brandLabel' =>'博客',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]);

if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => Yii::t('common','Signup'), 'url' => ['/site/signup']];
$menuItems[] = ['label' => Yii::t('common','Login'), 'url' => ['/site/login']];
} else {
$menuItems[] =[

'label' =>'<img src="'.Yii::$app->params['touxiang'].'" alt="'.Yii::$app->user->identity->username.'">',
'linkOptions'=>['class'=>'avatar'],
//使用组件报错的地方
'items'=>[
['label' =>'<i class="fa fa-sign-out"></i>退出','url' => ['/site/logout'], 'linkOptions'=>['data-method'=>'post']]
]

];


}
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'encodeLabels'=>false,
'items' => $menuItems,
]);

NavBar::end();
xuzuning 2018-08-19
  • 打赏
  • 举报
回复
指出错误行在哪里
sinat_37552373 2018-08-19
  • 打赏
  • 举报
回复
使用的所有挂件都报错了

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧