I need to read the value from url in php code. Below is the sample url . I am passing the value after php file name. I know that we can use query string like "www.smple.com/sample.php?name=value"
But requirement is url need to filename/value, this value will be dynamic. Please any one can help me to solve this issue.
Use parse_url to get the path from the URL and then use explode to split it into its segments.
$uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri_segments = explode('/', $uri_path);
echo $uri_segments[1];