接口地址:https://api.aaayun.cc/?type=Image&file=BaiDuRand&class=美女&sub=写真

参数sub可不填写

    function image($class, $sub = '', $rand = 1000) {
        $i = rand(0, $rand);
        $url = "http://image.baidu.com/data/imgs?pn=0&rn=18&col=%E5%A3%81%E7%BA%B8&tag={$class}&tag3={$sub}&width=0&height=0&ic={$i}&ie=utf8&oe=utf-8&image_id=&fr=channel&p=channel&from=1&app=img.browse.channel.wallpaper&t=0.08688646721576121";
        $content = file_get_contents($url);
        $Json = json_decode($content, 1);
        $Num = count($Json['imgs']);
        $Arrnum = rand(0,$Num-2);
        return $Json['imgs'][$Arrnum]['imageUrl'];
    }

    $img = image('动漫美女');
    $suff = ltrim(strrchr($img, '.'), '.');
    header("content-type:image/{$suff}");
    echo file_get_contents($img);

屏幕截图(4).png