duanji1610 2014-03-17 10:21
浏览 36
已采纳

PHP 5.4中的HTTP响应[关闭]

I know HTTP extension is depracated in PHP 5.3 onwords. So is their any way to make a HTTP response. This is my php code in php 5.2. How to make it suitable for php 5.4.

//process the request by fetching the info
$headers = http_get_request_headers();
$result = http_get_request_body();
//do stuff with the $headers and $result variables....
//then send your response
HttpResponse::status(200);
HttpResponse::setContentType('text/xml');
HttpResponse::setHeader('From', 'ABCD');
HttpResponse::setData($sq_data);
HttpResponse::send();
  • 写回答

1条回答 默认 最新

  • drau89457 2014-03-17 10:53
    关注

    I think this is based on a misunderstanding:

    "in further version of php http extension is not available. iam using wamp server."

    The PECL HTTP extension is perfectly available for any current PHP version, it's simply not installed by default and must be installed as a PECL extension. In the best case that's as simple as this typed on the command line:

    $ pecl install pecl_http
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?