note 61372 added to ref.dir
| From: | enginbzzztbiz at osu1 dot php dot net | Date: | Wed, 01 Feb 2006 20:07:19 +0000 |
| Subject: | note 61372 added to ref.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102837@lists.php.net to get a copy of this message | ||
To join directory and file names in a cross-platform manner you can use the following function.
function join_path()
{
$num_args = func_num_args();
$args = func_get_args();
$path = $args[0];
if( $num_args > 1 )
{
for ($i = 1; $i < $num_args; $i++)
{
$path .= DIRECTORY_SEPARATOR.$args[$i];
}
}
return $path;
}
It should do the following:
$src = join_path( '/foo', 'bar', 'john.jpg' );
echo $src; // On *nix -> /foo/bar/john.jpg
$src = join_path( 'C:\www', 'domain.com', 'foo.jpg' );
echo $src; // On win32 -> C:\\www\\domain.com\\foo.jpg
----
Server IP: 85.111.4.6
Probable Submitter: 85.102.186.149
----
Manual Page -- http://www.php.net/manual/en/ref.dir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61372
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61372&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61372&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61372&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61372&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61372&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61372&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61372&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61372&report=yes
Search -- http://master.php.net/manage/user-notes.php