We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

midniteslayr on 07/09/08


Tagged

urlformatting


Versions (?)


Who likes this?

5 people have marked this snippet as a favorite

koncept
heinz1959
logankoester
Nix
carlosabargues


Format URL to go to the same directory


Published in: PHP 


This allows you to format the URL to go to the directory where the file is placed. Very useful if you are wanting to write server independent PHP Apps.

  1. $location = 'http://'.$_SERVER['SERVER_NAME'].implode("/", explode("/", $_SERVER['PHP_SELF'], -1)).'/';

Report this snippet 

You need to login to post a comment.