0
任何人都可以请告诉我为什么即时通讯这个错误? (参数设置,我可以得到它的回声值)yii2无法获得查看传递参数在控制器
Too few arguments to function app\controllers\admin\SiteDeveloperController::actionView(), 0 passed and exactly 1 expected
+信息 我通过用户身份通过的indexAction myController的查看文件,这样我就可以访问用户ID,鉴于与$用户> ID;
public function actionIndex()
{
$this->layout = "site-developer";
if (Yii::$app->user->can('superuser')) {
if (!Yii::$app->user->isGuest) {
$user = Yii::$app->user->identity;
return $this->render("index", [
'user' => $user
]);
} else {
echo "you cant access this";
}
} else {
throw new ForbiddenHttpException("you cant access this");
}
}
没有我尝试通过当前$用户> id来的actionView myController的...但它说(ArgumentCountError 0过去了,究竟1预期)
public function actionView($id)
{
$mode = $this->findModel($id);
print_r($mode);
//return $this->render("view");
}
,这是按钮即通过id来控制器动作
<?= Html::a('<span class="glyphicon glyphicon-user"></span><br>پروفایل',['view','id' => $user->id],['class' => 'btn btn-primary btn-lg'])?>