parse_url is a simple tool/predefined function to parse/divide URL into individual components.
components are:
2. host
3. path
4. query
example:
<?php //URL $url = "http://www.phpjavascript.com/post.php?par1=one&par2=two"; $url = parse_url($url); //print_r($url); echo 'scheme = '.$url['scheme']; echo 'host = '.$url['host']; echo 'path = '.$url['path']; echo 'query = '.$url['query']; ?> Result: scheme = http host = www.phpjavascript.com path = /post.php query = par1=one&par2=two
No comments:
Post a Comment