【发布时间】:2016-03-12 12:39:09
【问题描述】:
我在获取频道名称(标题)方面需要帮助。我想用json_decode 来做,但我不知道怎么做。请帮助我 :) 谢谢 :)
$url="https://www.googleapis.com/youtube/v3/channels?part=snippet&forUsername=$youtubechannel&key=YOUR_KEY&getJSON";
$json = file_get_contents($url);
$json_result = json_decode($json, TRUE);
$raw_channel_name = $json_result->results[0];
$channel_name = $raw_channel_name->title;
echo $channel_name;
【问题讨论】: