2014-02-12 115 views
2

我安装在Windows pecl_http延伸,我跑了下面的代码:pecl_http扩展不工作

<?php 
$r = new HttpRequest('http://example.com/feed.rss', HttpRequest::METH_GET); 
$r->setOptions(array('lastmodified' => filemtime('local.rss'))); 
$r->addQueryData(array('category' => 3)); 
try { 
    $r->send(); 
    if ($r->getResponseCode() == 200) { 
     file_put_contents('local.rss', $r->getResponseBody()); 
    } 
} catch (HttpException $ex) { 
     echo $ex; 
} 
?> 

我得到如下错误:

Fatal error: Class 'HttpRequest' not found in C:\xampp\htdocs\web_services\pecl_http.php on line 3 

这是我如何安装pecl_http:

下载并添加以下行到php.ini(线程安全vc9)

extension=php_raphf.dll 
extension=php_propro.dll 
extension=php_http.dll 

这是我所得到的,当我跑的phpinfo()函数:

enter image description here

我使用PHP 5.4.22(XAMPP)在Windows 8

为什么会出现这类不当我启用pecl扩展时发现错误?

回答