Follow suit, jump
2) {foreach ($ matchs [2] as $ k => $ v) {$ links [$ v] = $ matchs [1] [$ k];} return $ links;} function getImgUrls ($ url) {$ html = file_get_contents ($ url); preg_match_all ('', $ html, $ matchs); return count ($ matchs)> 1? $ Matchs [1]: null;} function getImage ($ path, $ url) {preg_match ('/img \/(\ w + )\. jpg/', $ url, $ match); $ filepath = $ path. DIRECTORY_SEPARATOR. $ match [1]. '.jpg '; ob_start (); readfile ($ url); $ img = ob_get_contents (); ob_end_clean (); $ fp = @ fopen ($ filepath, 'A '); fwrite ($ fp, $ img); fclose ($ fp);} while ($ page $ v) {$ k = str_replace ('','', $ k ); // for GBK-encoded Windows, the following line must be converted to the character format // $ k = mb_convert_encodi Ng ($ k, 'gb2312', 'utf-8'); $ k = strip_tags ($ k); if (! File_exists ($ k) {echo '>>> Make directory '. $ k. PHP_EOL; mkdir ($ k, 0755, true);} $ img_urls = getImgUrls ($ v); foreach ($ img_urls as $ key => $ value) {echo '> Downloading '. $ value. PHP_EOL; getImage ($ k, $ value) ;}}$ page ++ ;}