PHP: How do I get the URL a file is in? -
I can not find a super-global for this. Actually, if any PHP file is executed, say, Code> http://www.example.com/services/page.php , I would like to retrieve http://example.com/service/
. How do I get it?
You can abuse:
& lt; P & gt; & Lt ;? Php echo $ _SERVER ["HTTP_HOST"] Dirname ($ _ SERVER ["REQUEST_URI"])? & Gt; & Lt; / P & gt;
Comments
Post a Comment