检索令牌的最佳方法是什么?#9; r9QQ5koqJT_e8iKAqSM2hhj"来自标题。
Host: localhost
Authorization: Bearer r9QQ5koqJT_e8iKAqSM2hhj
Content-Type: application/json
X-Version: 1
Accept: application/json
Content-Length: 61
答案 0 :(得分:2)
要阅读标题,如果您还不知道如何获取标题,请查看http://php.net/manual/en/function.getallheaders.php
要获取令牌,请参阅示例代码
<?php
if (substr($header, 0, 7) !== 'Bearer ') {
return false;
}
return trim(substr($header, 7));