' ' ]); //$JSON = JSON_decode($data $num = preg_match_all('/"url":"(.*?)"/',$data,$date); if(!$num){ if($type == 'text'){ exit('获取失败请重试'); }else{ exit(need::json(array('code'=>-1,'text'=>'获取失败请重试'))); } } $rand = mt_rand(0,$num-1); $image = str_replace(['\\', 'http:'], ['', 'https:'], $date[1][$rand]); /* if(!stristr($image, 'ssl')){ $image = str_replace(['http://', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'], ['https://', 'p1.ssl', 'p2.ssl', 'p3.ssl', 'p4.ssl', 'p5.ssl', 'p6.ssl', 'p7.ssl', 'p8.ssl', 'p9.ssl'], $image); } */ if($type == 'text'){ exit($image); }else if($type == 'image'){ //$data = file_get_Contents($image); need::send($image, 'location'); }else{ exit(need::json(array('code'=>1,'text'=>$image))); }