Call to undefined function apache_request_headers()

前端 未结 6 970
广开言路
广开言路 2020-11-27 04:58

I\'ve just switched my scripts to a different server. On the previous server this worked flawlessly, and now that I\'ve switched them to a different server, I can\'t underst

6条回答
  •  暖寄归人
    2020-11-27 05:34

    Pleae use follownig methord to get headers using PHP in Nginx

    function getHeaders()
    {
    $headers = array();
    foreach ($_SERVER as $k => $v)
    {
    if (substr($k, 0, 5) == "HTTP_")
    {
    $k = str_replace('_', ' ', substr($k, 5));
    $k = str_replace(' ', '-', ucwords(strtolower($k)));
    $headers[$k] = $v;
    }
    }
    return $headers;
    }
    

    Source from this page

提交回复
热议问题