The PATH_INFO variable has been encountered in various contexts, but its true nature remains elusive. To gain a clear understanding of PATH_INFO, we must delve into its origins.
Apache Web Server and PATH_INFO
PATH_INFO is not solely a PHP concept but is heavily associated with the Apache Web Server. When serving PHP pages, Apache can leverage the AcceptPathInfo directive to parse URLs beyond directory and filename components.
When AcceptPathInfo is enabled, PATH_INFO captures any additional pathname information trailing an actual file or non-existent file within a directory. It stores this information regardless of whether the request is accepted or rejected. These environment variables are then relayed to the Apache/CGI module, ultimately reaching PHP through $_SERVER['PATH_INFO'].
Understanding PATH_INFO
Consider an example: if the directory /test/ contains only the file here.html, requests for both /test/here.html/more and /test/nothere.html/more will have their respective "/more" sections collected into PATH_INFO. This allows for dynamic URL interpretation beyond traditional GET parameters.
Reference
For further exploration, refer to the Apache Core Documentation:
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3