I have 2 lines and replace them, so I only get parts of the URI.
$base_url = 'http://localhost/project/'; $url = 'http://localhost/project/controller/action/param1/param2';
I am checking parts of a URI.
$only_segments = str_replace($base_url, '', $real_url);
Basically I do: {url} - {base_url} = {only_segments}
Then I can get the segments:
$parts = explode('/', $only_segments); print_r($parts);
Question:
Am I on the right track, or can this be done easier with $ _ SERVER ['REQUEST_URI'] ?
Note. I do not want project in parts of the URI, it is a subfolder of localhost.
source share