when rendering array with double digit from controller to view page the array is displaying only the first single digit value
views/view1.php
<a class="btn btn-success" href="index.php?r=followusers/follow&id=<?= $follower1, $followed1; ?>" >Follow</a>
controller
public function actionFollow($id)
{
$model = Followusers::findOne($id);
return $this->render('follow', [
'model' => $model, 'id' => $id,
]);
views/follow.php
Yii::$app->db->createCommand()
->insert('followusers', [
'follower' => $id[0],
'followed' => $id[1],
])->execute();
Yii::$app->response->redirect(['user/view1','id' => $id[1]]);
}
when the $follower1 or $followed1 is assigned with 10 its only taking 1 to the id on clicking the follow button why it is occurring is there any blunder in my code
thanks in advance
i actually done mistake while passing parameters to url it should be done in this manner
<a class="btn btn-success" href="index.php?r=followusers/follow&id=<?= $follower1;?>&usr=<?= $followed1;?>" >Follow</a>
instead of above in the view1.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.