Reputation:
This code <?php echo Url::to(['/tasks/', 'view' => $task->id]);?>
transforms into the url web/tasks?view=1 what code and where will transform output variants into the web/tasks/view/1?
Upvotes: 1
Views: 34
Reputation: 1105
Config File:
'urlManager' => [
# code...
'rules' => [
'tasks/view/<id:\d+>' => 'tasks/view',
],
Controller-Action
public function actionView($id) {
// $_GET or \Yii::$app->getRequest()->GET('id')
$id = ... int id
# code..
}
View File:
<?php echo Url::to(['/tasks/view', 'id' => $task->id]);?>
Upvotes: 0