M
M
Maybe_V2016-08-10 20:39:50
Yii
Maybe_V, 2016-08-10 20:39:50

How to automatically generate a path?

How can it be implemented so that when switching to the controller without specifying any parameters, a certain path is formed!
For example, when the user enters into the command line http://user/index?id=or http://user/index?the path was automatically formed http://user/index?id=mainpage&user=1
. By what means is this implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Koryukov, 2016-08-11
@MadridianFox

Does the user need a path in the address bar?
Default values ​​in Yii2 are very easy to implement

public function actionIndex($id="mainpage", $user=1){
    // ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question