PHPRouter | An express inspired Routing library for PHP | Router library
kandi X-RAY | PHPRouter Summary
kandi X-RAY | PHPRouter Summary
PHPRouter is a simple routing extension for PHP inspired by express framework in Node.JS.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handles the command line arguments .
- Returns the PHPUnit configuration .
- Process a code coverage report .
- Generate mock class .
- Calculate analysis statistics .
- Returns the lines to be ignored .
- It will generate PHP code for a specific class .
- Run the process .
- Process child result .
- Recursive representation of a variable
PHPRouter Key Features
PHPRouter Examples and Code Snippets
Community Discussions
Trending Discussions on PHPRouter
QUESTION
I'm developing an MVC web app, and for its router to function I need to parse the query string, for which I need to load the URL into a variable in the first place. How do I achieve this with the PHP's built-in server?
I use PHP 7.3.9 at the moment, but as far as I can tell, the issue is persistent across all versions of a built-in server.
If I use Apache to run this app, everything is simple, all I need to do is
$uri = $_SERVER['QUERY_STRING'];
and I'm good to go, everything works just fine.
However, if I use PHP's built-in web server, I get an error saying:
Undefined index: QUERY_STRING in /path_to_my_project/public/index.php on line 22
I tried googling around and found this pull request suggesting that such a variable truly doesn't exist in the PHP's built-in web server.
So my question is: how do I obtain the query string for my router if I run the built-in server, where $_SERVER['QUERY_STRING']
doesn't exist?
ANSWER
Answered 2019-Sep-21 at 11:59You can get the same result by using REQUEST_URI
, if this is available:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PHPRouter
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page