标签:字符串
1.以文件流形式接受POST过来的数据:
$params = file_get_contents(‘php://input‘);
2.parse_url解析url,返回其组成部分。例如:
$ php -r ‘print_r(parse_url("http://username:password@hostname/path?arg=value#anchor"));‘ Array ( [scheme] => http [host] => hostname [user] => username [pass] => password [path] => /path [query] => arg=value [fragment] => anchor ) $ php -r ‘print_r(parse_url("http://invalid_host..name/"));‘ Array ( [scheme] => http [host] => invalid_host..name [path] => / )
3.parse_str把查询字符串解析到变量中。例如:
<?php parse_str("id=23&name=John%20Adams"); echo $id."<br />"; echo $name; ?>
输出:
23 John Adams
本文出自 “PHP程序猿” 博客,请务必保留此出处http://okowo.blog.51cto.com/4923464/1611131
标签:字符串
原文地址:http://okowo.blog.51cto.com/4923464/1611131