在下面的网址中下载对应版本的三个 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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 ; } } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】