PHP HTTP 请求
我安装了 MAMP Pro,运行 php 5.2.13。当我尝试初始化 HTTP 请求时,
$r = new HttpRequest('http://example.com/', HttpRequest::METH_GET);
它告诉我:
“在...中找不到‘HttpRequest’类”。
我需要做什么来“安装(?)”它?
I have MAMP Pro installed running php 5.2.13. When I try to initialize a HTTP-Request
$r = new HttpRequest('http://example.com/', HttpRequest::METH_GET);
it tells me:
"Class 'HttpRequest' not found in ...".
What do I need to do to 'install(?)' it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须启用http扩展:
http://www.php.net/manual/en/http.setup.php" php.net/manual/en/http.setup.php
或者你可以尝试新的 HTTP_Request2:
然后:
You must enable http extension:
http://www.php.net/manual/en/http.setup.php
Or you can try new HTTP_Request2:
And then:
MAMP 2.0 和 HTTP_Request2 的当代答案:
进入 MAMP/bin/php/php5.3.6/bin/ 并运行
重新启动服务器并使用 PEAR 存储库中的以下代码进行测试:
不要忘记 require_once 语句!
Contemporary Answer for MAMP 2.0 and HTTP_Request2:
Go into your MAMP/bin/php/php5.3.6/bin/ and run
Restart your server and test with the following code, from the PEAR repository:
Don't forget the require_once statement!
您需要启用扩展...
将以下内容添加到您的 php.ini
显然,有人问了很多:
http://php.bigresource.com/Track/php-33sNme7A/
You need to enable the extension ...
add the following to your php.ini
Apparently that was asked a lot:
http://php.bigresource.com/Track/php-33sNme7A/