在下面的网址中下载对应版本的三个 dll 文件 php_raphf.dll , php_propro.dll , php_http.dll
http://windows.php.net/downloads/pecl/releases/
在php.ini中增下以下三行,有不要填写完整的路径
extension=php_raphf.dll
extension=php_propro.dll
extension=php_http.dll
版本 2 之后的 pecl_http 扩展 这样调用
https://mdref.m6w6.name/http/Header/parse
https://mdref.m6w6.name/http
print_r(http\Header::parse($yourHeaders});
new http\Cookie($yourCookies);
不再支持 相关的 函数
<?PHP
if(function_exists("http_parse_headers")) echo 'Function Exists';
else echo 'Function Not Exists';
?>
提供一个类似的函数 https://stackoverflow.com/questions/6368574/how-to-get-the-functionality-of-http-parse-headers-without-pecl
if (!function_exists('http_parse_headers')) { function http_parse_headers($raw_headers) { $headers = array(); $key = ''; foreach(explode("\n", $raw_headers) as $i => $h) { $h = explode(':', $h, 2); if (isset($h[1])) { if (!isset($headers[$h[0]])) $headers[$h[0]] = trim($h[1]); elseif (is_array($headers[$h[0]])) { $headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); } else { $headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); } $key = $h[0]; } else { if (substr($h[0], 0, 1) == "\t") $headers[$key] .= "\r\n\t".trim($h[0]); elseif (!$key) $headers[0] = trim($h[0]); } } return $headers; } }