note 115307 deleted from function.dirname by salathe

From: Date: Thu, 03 Jul 2014 08:27:49 +0000
Subject: note 115307 deleted from function.dirname by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199822@lists.php.net to get a copy of this message
Note Submitter: alexcaigel at yahoo dot com ---- dirname can be used to create self referencing web scripts with the following one liner. <?php $base_url = str_replace($DOCUMENT_ROOT, "", dirname($PHP_SELF)); ?> Using this method on a file such as: /home/mysite/public_html/wherever/whatever.php will return: /wherever Now $base_url can be used in your HTML to reference other scripts in the same directory. Example for http://coralclub24.com/ href='<?=$base_url?>/myscript.php'

« previous php.notes (#199822) next »