使用PECL_HTTP的http_parse_headers [英] http_parse_headers with PECL_HTTP

查看:196
本文介绍了使用PECL_HTTP的http_parse_headers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用

解决方案

好的,经过长时间的搜索,我发现



PECL_HTTP 库的「http:rel =nofollow>版本2 完全不符合版本1 版本中不存在任何HTTP功能2



这在 PHP的文档中没有说明。 net



顺便说一句,版本2 是一个完全的OOP界面,并为所列的所有功能丢弃支持此处

如果您要查找功能API,请使用版本1



因此,根据里卡多的建议,您需要使用

  http\Header :: parse($ yourHeaders); 

来解析标头和

  new http\Cookie($ yourCookies); 

以解析Cookie等


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.

function_exists() always fails is there anything that I'm missing here?

I'm using

CentOS 6.7 (Final)

Apache 2.4.16

PHP 5.6

Update 1

Here is the Code!

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

Update 2

here is the 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

Here is the output of phpinfo()

解决方案

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

This is NOT stated ANYWHERE in the docs on PHP.net.

By the way, Version 2 is a completely OOP interface and drops support for all the functions listed here in the docs.

If you are looking for the functional API, use Version 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

这篇关于使用PECL_HTTP的http_parse_headers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆