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

问题描述

我想使用

解决方案

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



完全不符合



这在。



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



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

  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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 03:53
查看更多