1
私はlabel - > Profilを作成し、彼のURLを/ bloggers/viewに設定しましたが、ログインしてprofilを見てみるとエラーが表示されます。どのように問題を解決するか分からなかった!みんな助けてくれますか?なぜ私のactionViewはログインしているユーザーの$ id(私の場合はBlogger)を使用しないのですか?必要なパラメータがありません:Yii2のid actionView
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
私はこのアクションをユーザーにregistratingています:
public function actionRegister()
{
$model = new RegisterForm();
$user = new Blogger();
if(isset($_POST['register-button']))
{
$model->attributes = $_POST['RegisterForm'];
if($model->validate())
{
$user->username = $model->username;
$user->email = $model->email;
$pass_hash = md5($model->password);
$user->password = $pass_hash;
$user->save();
\Yii::$app->user->login($user);
$this->redirect('index');
}
}
return $this->render('register',[
'model' => $model,
]);
}
私はまだ初心者と私はコードで愚かthnigをしたmaybaハードですが、ご容赦くださいadvaceにありがとう!
おい、本当に..あなたは私の救い主です!どうもありがとうございます! –