[英]PHP Not Recognizing http_get_request_headers()?
I'm calling http_get_request_headers() in a PHP file on a server running PHP 5. However, I'm getting Fatal error: Call to undefined function http_get_request_headers(). 我在运行PHP 5的服务器上的PHP文件中调用http_get_request_headers()。但是,我收到致命错误:调用未定义的函数http_get_request_headers()。 Does anyone know what the problem might be? 有谁知道问题可能是什么? Does this function not come with plain PHP? 这个函数不是普通的PHP吗?
No it does not. 不,不是的。 You need a PECL module for that function to work. 您需要一个PECL模块才能使该功能正常工作。 But you can use the contents of the $_SERVER variable as stated in this comment on the php site. 但是您可以使用PHP站点上此注释中所述的$ _SERVER变量的内容。 Alternatively you can use the apache function if this is your web server. 或者,如果这是您的Web服务器,则可以使用apache函数 。
If you're using version >= 2 of pecl_http
you'll need to use the namespace syntax for calling the functions. 如果您使用的是pecl_http
版本> = 2, pecl_http
需要使用命名空间语法来调用函数。 Check out the version 2 documentation here and example here 在这里查看版本2文档和示例
Basically \\http\\Env::getRequestHeader()
基本上\\http\\Env::getRequestHeader()
That function is part of the PECL extension. 该功能是PECL扩展的一部分。
Follow the instructions on this page to install it: http://ar.php.net/manual/en/http.install.php 按照此页面上的说明进行安装: http : //ar.php.net/manual/en/http.install.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.