Hello, This is my url: http://localhost/index/others/28711/macbook-drivers-for-windows-xp.htm I need to get a directory name which is "others" on this case. How can i do this? Thanks
Do you mean you need to get a file from the others directory? Just go back to levels. http://localhost/index/others (back two)/back one/current level include('../FILE OR DIRECTORY + FILE'); PHP:
i did like this but i do not know if it is the right way $serverurl = $_SERVER['REQUEST_URI']; $parsed_url = parse_url($serverurl); $exploded = explode('/', $parsed_url['path']); $second = $exploded[2]; echo $second; PHP: