简体   繁体   English

带有PECL_HTTP的http_parse_headers

[英]http_parse_headers with PECL_HTTP

I wanted to use http_parse_headers So, I've installed dependency pecl_http(2.4.3/2.2.5) and call http_parse_headers function with no success. 我想使用http_parse_headers所以,我已经安装了依赖pecl_http(2.4.3/2.2.5)并调用http_parse_headers函数没有成功。

function_exists() always fails is there anything that I'm missing here? function_exists()总是失败有什么我在这里缺少的吗?

I'm using 我正在使用

CentOS 6.7 (Final) CentOS 6.7(最终版)

Apache 2.4.16 Apache 2.4.16

PHP 5.6 PHP 5.6

Update 1 更新1

Here is the Code! 这是守则!

<?PHP
    if(function_exists("http_parse_headers")) echo 'Function Exists';
    else echo 'Function Not Exists';
?>

Update 2 更新2

here is the php.ini 这是php.ini

......
......
extension=pdo.so
extension=pdo_sqlite.so
extension="memcache.so"
extension="raphf.so"
extension="propro.so"
extension="http.so"
extension=pdo_mysql.so

Update 3 更新3

Here is the output of phpinfo() 这是phpinfo()的输出

phpinfo()的输出

The PHP docs are incorrect. PHP文档不正确。 Version 2 of the library is incompatible with the functions listed in php.net. 该库的版本2与php.net中列出的函数不兼容。

Reading the new documentation you now have to use HTTP::parse as such: 阅读新文档,您现在必须使用HTTP :: parse

http\Header::parse($yourHeaders)

Ok, After a long long search I found that 好的,经过长时间的长时间搜索,我发现了

Version 2 of PECL_HTTP library is COMPLETELY INCOMPATIBLE with Version 1 None of the HTTP functions exists in Version 2 版本2PECL_HTTP库与完全不兼容版本1所无的HTTP函数中存在第2版

This is NOT stated ANYWHERE in the docs on PHP.net . 这在PHP.net上的文档中没有任何声明。

By the way, Version 2 is a completely OOP interface and drops support for all the functions listed here in the docs. 顺便说一句, 第2版是一个完全面向对象的接口和眼药水中列出的所有功能,支持这里的文档。

If you are looking for the functional API, use Version 1 如果您正在寻找功能API,请使用版本1

So, as suggested by Ricardo you need to use 所以,正如里卡多所建议你需要使用的

http\Header::parse($yourHeaders);

to parse header and 解析标题和

new http\Cookie($yourCookies);

to parse cookie etc 解析cookie等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM