我已经在我的申请中实施了护照,并使用邮递员来测试api。但是标头中缺少Authorization标头。下面是我的
.htaccess文件。
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
当我尝试这个时
Route::get('/setup', function (Request $request){
var_dump($request->headers);
});
我明白了
object(Symfony\Component\HttpFoundation\HeaderBag)#44 (2) {
["headers":protected]=>
array(8) {
["host"]=>
array(1) {
[0]=>
string(14) "162.243.23.252"
}
["connection"]=>
array(1) {
[0]=>
string(10) "keep-alive"
}
["accept"]=>
array(1) {
[0]=>
string(16) "application/json"
}
["cache-control"]=>
array(1) {
[0]=>
string(8) "no-cache"
}
["user-agent"]=>
array(1) {
[0]=>
string(105) "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36"
}
["postman-token"]=>
array(1) {
[0]=>
string(36) "acac2f9b-9c71-fb9a-ebd5-62516eb4fd36"
}
["accept-encoding"]=>
array(1) {
[0]=>
string(19) "gzip, deflate, sdch"
}
["accept-language"]=>
array(1) {
[0]=>
string(14) "en-US,en;q=0.8"
}
}
["cacheControl":protected]=>
array(1) {
["no-cache"]=>
bool(true)
}
}
任何解决方案?