N
N
nepster-web2014-03-17 10:23:39
Yii
nepster-web, 2014-03-17 10:23:39

How to ignore case in Yii2 actions?

Faced such a problem:
I wrote this action:

public function actionUpdateContact($id)
  {
              ...
  }

At the same time, I can’t get to this through the url. I try:
site.ru/admin/users/UpdateContact - 404
site.ru/admin/users/updateContact - 404
site.ru/admin/users/Updatecontact - 404
site.ru/admin/users/updatecontact - 404

However, if you write the name of the action like this: actionUpdatecontact
site.ru/admin/users/UpdateContact - 404
site.ru/admin/users/updateContact - 404
site.ru/admin/users/Updatecontact - 404
site.ru/admin/users/updatecontact - ОК

My configs:
'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,

      //'enableStrictParsing' => true,
      'suffix' => '',
            
      'rules' => [
                '' => 'admin/default/index',
                
        // Модуль   
                'users/<action:\w+>/<id:\d+>' => 'users/default/<action>',              
                'users/<action:\w+>/<page:\d+>' => 'users/default/<action>',         
                'users/<action:\w+>/' => 'users/default/<action>',
                
                
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
              
      ]
    ],

Can you please tell me how to ignore case in url in actions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Morozov, 2014-03-17
@nepster-web

actionUpdateContact = /update-contact

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question