by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 years ago )

Apache removed the Authorization Header, and there is no solution in $_SERVER.

You can try to add the following content in .htaccess, and it will be normal.
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
In this way, you can use pure PHP to get the token in the header of the request.
<?php
echo $_SERVER['HTTP_AUTHORIZATION'];

 

Tags: php

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


docker,phpenv

Unable to ping host.docker.internal on Linux

You can check with docker version, confirm that the version is Docker v20.10+, you can add extra_hosts as follows:

php

How to install PHP 7.1.7 in the old version of CentOS 5.11?

How to install PHP 7.1.7 on the old version of CentOS 5.11? An insfinit error occurred when compiling by myself. This article introduces my method.

php

Talking about PSRs

The full name of PSR is called "PHP Standards Recommendations" (PHP Standards Recommendations). A proposed specification developed by FIG (PHP Framework Interoperability Group), This group was initiated by some framework developers in php|tek in 2009, from the first 5 to more than 20 now. There are many numbers in the "PHP Standard Recommendations", each number represents a different specification.