PHP Dirname

dirname() function is used to return a string containing the full path to remove the file name of the directory, the successful return of the string, otherwise return FALSE.


string dirname(string path)


Assuming the local access to the file URL address: http://

echo $PHP_SELF; // output /html/test.php
echo dirname($PHP_SELF); // output /html

this function with thebasename()function is often used for URL handling.

Copyright 2014-2017 by All Rights Reserved.