无法获取php数组值

时间:2015-03-15 21:30:10

标签: php arrays

也许我在这上花了太长时间。我有这个代码

$requestHeaders = getallheaders();
$authorizationHeader = $requestHeaders["authToken"];

print_r($requestHeaders);
echo $authorizationHeader;

// check that a auth header was sent
if ($authorizationHeader == null) {
    header('HTTP/1.0 401 Unauthorized');
    echo "No authorization header sent";
    exit();
}

输出

Array
(
    [Host] => localhost
    [Content-Type] => application/x-www-form-urlencoded
    [Cookie] => pma_collation_connection=utf8_unicode_ci; pma_lang=en
    [Connection] => keep-alive
    [authToken] => eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
    [Accept] => */*
    [Accept-Language] => en-us
    [Authorization] => Basic Og==
    [Accept-Encoding] => gzip, deflate
    [User-Agent] => CocoaRestClient/11 CFNetwork/720.3.9 Darwin/14.3.0 (x86_64)
)
No authorization header sent

为什么我不能通过缝合来获取数组中的auth-Token值?

0 个答案:

没有答案