Call to undefined function apache_request_headers()

前端 未结 6 963
广开言路
广开言路 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:47

    if php is installed as an Apache module:

    apache_request_headers()["Authorization"];
    

    else, go to .htaccess file and add:

    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    

    You can then access request headers using any of these:

    $_SERVER["HTTP_AUTHORIZATION"]; // using super global
    

    OR

    $app->request->headers("Authorization"); // if using PHP Slim
    

提交回复
热议问题