Answer the question
In order to leave comments, you need to log in
Why aren't rules applied when passed to a url link as a string?
Question out of curiosity.
Rules are written:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'all' => 'tests/all',
],
],
<?= \yii\helpers\Html::a('Смотреть все тесты', ['tests/all']) ?> <!-- rules работают -->
<?= \yii\helpers\Html::a('Смотреть все тесты', 'tests/all') ?> <!-- rules не работают -->
Answer the question
In order to leave comments, you need to log in
Html::a() passes the second parameter "url" to the Url::to() method here is the Url
::to()
documentation
where it says:
... if $url is:
...
* a normal string: it will be returned as is.
...
Here is the answer to your question)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question