note 124397 added to function.pathinfo
| From: | 610010559 at qq dot com | Date: | Fri, 15 Nov 2019 04:25:49 +0000 |
| Subject: | note 124397 added to function.pathinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-213056@lists.php.net to get a copy of this message | ||
about the path, there are one thing you should note :
On Windows, both slash (/) and backslash (\) are used as directory separator character. In other
environments, it is the forward slash (/). (this explain is from basename() function part https://www.php.net/manual/en/function.basename.php)
example:
<?php
$path = "http://www.test.com/a\b\c\filename.pdf";
echo pathinfo($pdfUrl, PATHINFO_BASENAME); //get basename
//output
//on window: result is filename.pdf
//on Linux: result is a\b\c\filename.pdf (that is may not your expect)
//so in order to get same result in different system. i will do below first.
$path = str_replace($path, '\\', '/'); //convert '\' to '/'
?>
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.168 (proxied: 117.27.75.146)
----
Manual Page -- http://php.net/manual/en/function.pathinfo.php
Edit -- https://master.php.net/note/edit/124397
Del: integrated -- https://master.php.net/note/delete/124397/integrated
Del: useless -- https://master.php.net/note/delete/124397/useless
Del: bad code -- https://master.php.net/note/delete/124397/bad+code
Del: spam -- https://master.php.net/note/delete/124397/spam
Del: non-english -- https://master.php.net/note/delete/124397/non-english
Del: in docs -- https://master.php.net/note/delete/124397/in+docs
Del: other reasons-- https://master.php.net/note/delete/124397
Reject -- https://master.php.net/note/reject/124397
Search -- https://master.php.net/manage/user-notes.php