0

我会尽量不要混淆,但我确实对这种情况感到困惑。

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

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

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

这是 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、mail

\::<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]

生产 JSON 中缺少的东西是 - position_category - position_code - region_code - mail

最重要的是mail。知道为什么它在生产中丢失了吗?我在哪里可以确认在标头中添加了哪些值,为什么在这种情况下会遗漏任何值?

非常感谢。

4

0 回答 0