I have a long path for a file, for instance,
http://www.mysite.com/local/views/templates/home.php
and I use basename() to return the file itself only,
<?php echo basename($file);?>
But how can I return the file’s path without the file’s basename like the line below?
http://www.mysite.com/local/views/templates/
You are looking for
dirname(although it doesn’t leave a trailing slash).See it in action.