在HTML呈现你好,我有一个PHP文件与包括:但是PHP图像不使用img元素
的图片显示正常,当我访问了PHP文件,当我尝试以显示它在HTML模板,它显示了在一条门缝的小IMG,所以基本上说:“没有找到图片”
<img src="http://konvictgaming.com/status.php?channel=blindsniper47">
是我使用的HTML模板来显示它是什么,但它只是似乎并不想显示,我试过寻找旁边没有结果为我的具体问题,虽然我确定我可能搜索了错误的标题
添加代码从OP下面
$clientId = ''; // Register your application and get a client ID at http://www.twitch.tv/settings?section=applications
$online = 'online.png'; // Set online image here
$offline = 'offline.png'; // Set offline image here
$json_array = json_decode(file_get_contents('https://api.twitch.tv/kraken/streams/'.strtolower($channelName).'?client_id='.$clientId), true);
if ($json_array['stream'] != NULL) {
$channelTitle = $json_array['stream']['channel']['display_name'];
$streamTitle = $json_array['stream']['channel']['status'];
$currentGame = $json_array['stream']['channel']['game'];
echo "<img src='$online' />";
} else {
echo "<img src='$offline' />";
}
您不是指图像。实际图片网址是http://konvictgaming.com/offline.png – raam86
您指的是'http:// konvictgaming.com/offline.png'图片 – swapnesh