This article mainly introduces PHP processing URL string encoding, decoding and parsing. The following is a detailed illustration of theBase64_encode-uses MIME base64 to encode the data Base64_encode () returns uses Base64 to encode it. This encoding is designed to enable binary data to be transmitted through a 8-bit transport layer, such as the body of an e-mail message. base64-encoded data consumes about 33% more space than the original data. Code is as follows: <?php $str = ' This is a encoded string '; vghpcybpcybhbiblbmnvzgvkihn0cmluzw== Echo Base64_encode ($STR);?> base64_decode-pair using MIME base 64 encoded data for decoding Base64_decode () decoding the Encoded_data, returning the original data, failure returns FALSE. The returned data may be binary. Code as follows: <?php $str = ' vghpcybpcybhbiblbmnvzgvkihn0cmluzw== '; This is a encoded string echo base64_decode ($STR);?> get_headers-obtains all headers G sent by server in response to an HTTP request Et_headers () returns an array that contains the headers that the server responds to when an HTTP request is sent. Returns False if it fails and emits an error message at the e_warning level. If you set the optional format parameter to 1, Get_headers () parses the appropriate information and sets the key name of the array. Code as follows: <?php $phpha 1 = get_headers (' http://www.jb51.net '); $phpha 2 = get_headers (' http://www.jb51.net ', 1); Print_r ($phpha 1); Print_r ($phpha 2);?> output is as follows: code as follows: Array (  => HTTP/1.1 OK  => server:nginx/1.2.2  => date:tue, Nov-10:17:59 GMT  => content-type:text/html; Charset=utf-8  => connection:close  => x-powered-by:php/5.3.8  => x-pingback:http://www.jb51.net/xmlrpc.php  => via:10.67.15.26  => Set-cook ie:saeut=184.108.40.206.1352197078737175; path=/; max-age=311040000) Array (  => http/1.1 OK [Server] => nginx/1.2.2 [Date] => Tue, Nov 10:17:59 GMT [content-type] => text/html; Charset=utf-8 [Connection] => close [x-powered-by] => php/5.3.8 [X-pingbac K] => http://www.jb51.net/xmlrpc.php [Via] => 10.67.15.21 [Set-cookie] => saeut=124.1 220.127.116.112197079055460; path=/; max-age=311040000) Get_meta_tags-Extracts all meta tag content attributes from a file, returning an array can be imagined, some Web sites can easily use this function for the site SEO information extraction. Code as follows: <?php//tianya php blog http://www.jb51.net $phpha = get_meta_tags (' http://www.jb51.net '); Print_r ($phpha);?> output is as follows: code as follows: Array ( [keywords] => tianya blog, PHP blog, PHP technology blog, PH P Learning Blog, PHP development blog [description] => tianya PHP blog is based on PHP-oriented learning blog, record Phper learning process, pay attention to the latest development of the Internet. [generator] => WordPress 3.2.1) http_build_query-request string after generating Url-encode <?php $url = Array (' C ' => ' blog ', ' A ' => ' show ', ' id ' =>10, ' hello ', ' world '); C=blog&a=show&id=10&0=hello&1=world Echo http_build_query ($url); C=blog&a=show&id=10&phpha_0=hello&phpha_1=world Echo http_build_query ($url, ' jb51_ ');?> [/ Code] This function I use most of the place is to do a variety of APIs, the combination of the requested URL, very convenient. You can also see a prefix for the members of a numeric index within an array. parse_url-resolves the URL and returns its components this function resolves a URL and returns an associative array containing the various components that appear in the URL. This function is not used to verify the legality of a given URL, but to decompose it into the sections listed below. Incomplete URLs are also accepted, pArse_url () tries to parse it as correctly as possible. Code as follows: <?php $url = ' Http://tianya:firstname.lastname@example.org/hello.php?id=10#nav '; Print_r (Parse_url ($url));?> Array ( [scheme] => http [host] => phpha.com &NBS P [user] => Tianya [pass] => phphadotcom [path] =>/hello.php [query] =&G T id=10 [fragment] => nav) rawurlencode-encoding URLs according to RFC 1738 rawurldecode-to encoded URL characters String to decode urlencode-encoded URL string urldecode-decode the encoded URL string code as follows: <?php $url = ' http://www.jb51.net Tianya '; echo UrlEncode ($url); echo ' <br/> '; echo Rawurlencode ($url); echo ' <br/> '; echo UrlDecode ($url); echo ' <br/> '; echo Rawurldecode ($url);?> output is as follows: code is as follows: Http%3a%2f%2fwww.jb51.net+tianya http%3a%2f% 2fwww.jb51.net%20tianya You can see that the difference between UrlEncode and Rawurlencode is that UrlEncode () will encode the space as a plus sign (+), Rawurlencode () The space is encoded as%20 UrlDecode () and RawurldecoDe () is the corresponding decoding function.