php - Yii2 stripping ending slash in Url::to() route when using params -
I am using Yii2 and using the method without any problems. Now I try to do this with the parameter for the first time and it will miss the slash that ends with my path.
Normally, I will do this:
url :: ('/ my / route /', is true); // http://www.example.com/my/route/ But if I want to pass the parameter like:
url: : ('[' / 'Mine / route' ',' id '= 123,' name '=>' lari ']', is true); // http://www.example.com/my/route?id=123&name=larry Is there any way to prevent this from happening, if not, then my What is near
My UrlManager rule:
'rule' = & gt; [['Pattern' = & gt; 'Foo / & lt; Name: [0- 9A-ZA-Z +] - +>. & Lt; Some_ID: \ d + & gt; ',' path '= & gt; 'Foo / index', 'suffix' = & gt; '/',], // .........],
< P> 1) You can get this route by adding
suffix according to the URL rule containing: 'components' = & Gt; ['UrlManager' = & gt; ['EnablePrettyUrl' = & gt; True, 'showScriptName' = & gt; Wrong, 'rule' = & gt; [['Pattern' = & gt; 'My / path', 'route' = & gt; 'My / path', 'suffix' = & gt; Globally it is available through urlManager property with the same name 2) code> suffix .
'component' = & gt; ['UrlManager' = & gt; ['EnablePrettyUrl' = & gt; True, 'showScriptName' = & gt; Wrong, 'suffix' = & gt; Alternate way of setting via component: '/',],], 3) :
Yii :: $ App - & gt; UrlManager- & gt; Suffix = '/'; It also works for a specific route, just this line to url :: to () ;
Comments
Post a Comment