PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 26, 2022

[FIXED] how to route all sub requests to one action in yii2 framework

 February 26, 2022     action, php, routes, yii, yii2     No comments   

Issue

I want to catch all urls in one action like:

* http://my-domain.com/controller/myaction/test
* http://my-domain.com/controller/myaction/test2
* http://my-domain.com/controller/myaction/other_url

can I get it on "myaction"?


Solution

Try this something like this

'<controller:[\w\-]+>/<action:[\w\-]+>/<ident:\d+>/<token:\w+>/<module:\w+>' => '<controller>/<action>' // 2

above will take/create urls like

localhost/frontend/web/site/test-router/10/ADB/P120


Answered By - Ketan Vekariya
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing