我知道HTTP扩展在PHP 5.3 onword中已被弃用。因此,他们进行HTTP响应的任何方式都是如此。这是我在php 5.2中的php代码。如何使其适合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();
我认为这是基于一种误解:
“在进一步版本的php http扩展中不可用。iam使用了wamp服务器。”
PECL HTTP扩展名完美适用于任何当前的PHP版本,默认情况下它根本没有安装,而必须作为PECL扩展名安装。在最好的情况下,就像在命令行中键入的一样简单:
$ pecl install pecl_http
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句