给你的typecho添加每日60s读懂世界

2021-01-12T22:23:00

对于一个不是很熟悉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

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »