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

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -