|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-30 17:53 UTC] dd at selftrade dot com
If you submit a url like www..com to parse_url, it will parse it without any error, although this kind of URL is incorrect. Try this: <? $url="http://www..com"; $a=parse_url($url); $host=$a[host]; $scheme=$a[scheme]; $path=$a[path]; echo("<LI>SCHEME=$scheme<LI>HOST=$host<LI>PATH=$path"); ?> It will return: SCHEME=http HOST=www..com PATH= The same kind of thing happens if url="qwerty", as it will return "qwerty" as the path. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
Just a note: "qwerty" on it's own still can be right (e.g. you have a subdomain qwerty.mydomain.com and set up your box that mydomain.com is in your domain search path). On the other hand: php -r 'print_r(parse_url("http://www][.ww_-/...._..-.../"));' Array ( [scheme] => http [host] => www][.ww_- [path] => /...._..-.../ ) So it looks like parse_url() only splits the url into it's distinct parts (which obviously works). If this is true, this needs to be documented. Anyone else comments?