PHP: on the day - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Linux Server Administration (https://www.linux-noob.com/forums/forum-8.html) +--- Forum: LAMP (https://www.linux-noob.com/forums/forum-83.html) +--- Thread: PHP: on the day (/thread-2090.html) |
PHP: on the day - jsn06 - 2006-03-14 Getting the current full URL in PHP Sometimes, you might want to get the current full URL in PHP. Here is how you do that. Add the following code to a page: Code: <?php You can now get the full URL using the line: Code: <?php print(selfURL()); ?> Removing empty elements in a PHP array, this works like the @Trim formula in Notes/Domino. Code: <?php Use it like this: Code: <?php The resulting $b array will have two entries, with the two empty ones removed. How to figure out your server’s real name. It is sometimes necessary to figure out the real server name. There are several ways to do this, but in PHP, a simple way is this: Code: <?php If you do not want to see the IP address of your website, you can use this single line of code: Code: <?php :P johnny06 PHP: on the day - znx - 2006-03-15 [img]<___base_url___>/uploads/emoticons/default_dry.png[/img] initially very dodgy with <br /> and 8002, 8003 stray bits in the code... BUT once cleaned up (a quick edit) it revealed itself. nice johnny06 :P |