对于一个不是很熟悉php的我来说,折腾了半天,我用9行写出来的东西,大佬给我改改变成了两行

这是大佬的:

header("content-type:image/jpg");
echo file_get_contents(json_decode(file_get_contents("http://api.03c3.cn/zb/api.php"))->imageUrl);

这是我的:

$data = file_get_contents("http://api.03c3.cn/zb/api.php"); 
$arr = json_decode($data, true); 
$zb= $arr['imageUrl'];
$url = str_replace('\/', '/',  json_encode($zb));
$zbw = explode('"',$url);
$img = $zbw[1];
header("content-type:image/jpg");
$str=file_get_contents("$img");
echo $str;

以typecho为例,新建文章或者页面,内容插入下面代码即可

 <img src="http://api.03c3.cn/zb" />

在这里感谢教书先生大佬

演示地址:http://www.789dl.cn/zb.html

最后修改:2021 年 02 月 08 日
如果觉得我的文章对你有用,请随意赞赏