{"access_token":"OeB89uEWZZzLPLMIsVBvJtIlnObM1sX7NNNWqwtjdzI.8LlxO2skN028HmcMw8F_BDiqEj9kDRfdVWc9f02WmiY","expires_in":43199,"scope":"","token_type":"bearer"}
如何仅通过access_token
访问它,如下所示:
$str = "OeB89uEWZZzLPLMIsVBvJtIlnObM1sX7NNNWqwtjdzI.8LlxO2skN028HmcMw8F_BDiqEj9kDRfdVWc9f02WmiY";
答案 0 :(得分:0)
以这种方式获取令牌,
<?php
$t = '{"access_token":"OeB89uEWZZzLPLMIsVBvJtIlnObM1sX7NNNWqwtjdzI.8LlxO2skN028HmcMw8F_BDiqEj9kDRfdVWc9f02WmiY","expires_in":43199,"scope":"","token_type":"bearer"}';
$a = json_decode($t);
print_r($a->access_token);
?>
输出
OeB89uEWZZzLPLMIsVBvJtIlnObM1sX7NNNWqwtjdzI.8LlxO2skN028HmcMw8F_BDiqEj9kDRfdVWc9f02WmiY
答案 1 :(得分:0)
您可以使用json_decode()
<?php
$json = '{"access_token":"OeB89uEWZZzLPLMIsVBvJtIlnObM1sX7NNNWqwtjdzI.8LlxO2skN028HmcMw8F_BDiqEj9kDRfdVWc9f02WmiY","expires_in":43199,"scope":"","token_type":"bearer"}';
$array = json_decode($json,true);
print_r($array['access_token']);