PHP getallheaders在Dev和Production上提供不同的头输出

时间:2013-08-12 17:55:31

标签: php web-services apache header

我尽量不要混淆,但我对这种情况感到非常困惑。

我在我的某个应用程序中使用getallheaders()来获取所有标头信息。它以下列方式使用: -

<?php 
    header('Content-Type: application/json');
    echo json_encode(getallheaders()); 
?>

现在的问题是它为我的开发和生产服务器提供了不同的输出,这就是为什么我的应用程序不能在Production上工作但它适用于Dev。我正尽力找到原因,但仍无济于事。

这是Dev(正确的一个)

的输出
\::<html><head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">

                {"accept":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8",
    "accept-language":"en-us",
    "connection":"close",
    "content-length":"0",
    "host":"production-host",
    "iv-user":"cn=First_Name%20Last_Name,
    ou=NYC,
    ou=NorthAmerica,
    o=Company_Name",
    "user-agent":"Mozilla\/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit\/536.26 (KHTML, like Gecko) Mobile\/10B141",
    "via":"HTTP\/1.1 .company_name.com:80",
    "**location_office_code" :"XYZ"**,
    "iv_server_name":"default-webseald-na-pcompanyname.intranet.company_name.com",
    "vendorid":"a_number",
    "person_id":"a_number",
    **"position_category":"NOT_FOUND","position_code":"NOT_FOUND",
    "region_code":"North%20America",
    "mail":"Email-Address"**,
    "x-forwarded-for":"IP_Address",
    "Cookie":"s_nr=1324338612-New"}</pre></body></html>


[INFO] :   strJsonContent information:

{"accept":"text\/html,application\/xhtml+xml,
application\/xml;q=0.9,*\/*;q=0.8",
"accept-language":"en-us",
"connection":"close",
"content-length":"0",
"host":"host_name",
"iv-user":"cn=FIRST_NAME%20LAST_NAME,
ou=NYC,
ou=NorthAmerica,
o=COMPANY_NAME",
"user-agent":"Mozilla\/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit\/536.26 (KHTML, like Gecko) Mobile\/10B141",
"via":"HTTP\/1.1 .comapny_name:80",
"location_office_code":"XYZ",
"iv_server_name":"default-webseald-na-comapny_name.com",
"vendorid":"a-number",
"person_id":"a-number",
"position_category":"NOT_FOUND",
"position_code":"NOT_FOUND",
"region_code":"North%20America",
"mail":"EMAIL_ADDRESS",
"x-forwarded-for":"IP_ADDRESS",
"Cookie":"s_nr=1324338612-New"
}

生产输出(缺少position_category,position_code,region_code,邮件

\::<html><head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">

{"accept":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,
*\/*;q=0.8",
"accept-language":"en-us",
"connection":"close",
"content-length":"0",
"host":"production-host",
"iv-user":"cn=First_Name%20Last_Name,
ou=NYC,
ou=NorthAmerica,
o=Company_Name",
"user-agent":"Mozilla\/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit\/536.26 (KHTML, like Gecko) Mobile\/10B141",
"via":"HTTP\/1.1 .company_name.com:80",
"iv_server_name":"default-webseald-na-pcompanyname.intranet.company_name.com",
"vendorid":"a_number",
"person_id":"a_number",
"x-forwarded-for":"IP_Address",
"Cookie":"s_nr=1324338612-New"}
</pre></body></html>


[INFO] :   strJsonContent information:
{"accept":"text\/html,application\/xhtml+xml,
application\/xml;q=0.9,
*\/*;q=0.8",
"accept-language":"en-us",
"connection":"close",
"content-length":"0",
"host":"host_name","iv-user":"cn=First_Name%20Last_Name,ou=NYC,ou=NorthAmerica,o=Company_Name",
"user-agent":"Mozilla\/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit\/536.26 (KHTML, like Gecko) Mobile\/10B141",
"via":"HTTP\/1.1 .company_name.com:80",
"iv_server_name":"default-webseald-na-pcompany_name.intranet.company_name.com",
"vendorid":"a_number",
"person_id":"a_number",
"x-forwarded-for":"IP_Address",
"Cookie":"s_nr=1324338612-New"}
    [INFO] :   responseAsJSON info:[object Object]

Production JSON中缺少的东西是   - position_category   - position_code   - region_code   - 邮件

最重要的是mail。知道为什么它在制作中缺失了吗?我在哪里可以确认在标题中添加了哪些值?为什么在这种情况下可以忽略任何值?

非常感谢。

0 个答案:

没有答案