4. finally, in order to make the document page truly a local page, the last step is to replace the link of the targeted content of the list page with the local link, which is quite simple: & lt ;? Phpset_time_limit (0); require_once (& quot;.../phpQuery. php & quot ;);
4. Finally, in order to make this document page truly a local page, we need to take the last step, that is, replacing the link of the targeted content of the list page with the local link, which is quite simple:
Html (); $ arr = preg_split ("/\ n/", $ a); unset ($ arr [0]); // print_r ($ arr ); foreach ($ arr as $ key => $ value) {preg_match ("/(. *) <\/a>/", $ value, $ array); $ tailarr = explode ("/", $ array [1]); // echo $ tailarr [count ($ tailarr)-1]."
"; $ Tails = $ tailarr [count ($ tailarr)-1]; $ tail = strtolower ($ tails); $ taillink = ". /". $ tail. ". html "; pq (". vt li: eq (". ($ key-1 ). ")")-> find ("a")-> attr ("href", $ taillink);} $ content = pq (". vt ")-> html (); file_put_contents (". /manual/index.html ", $ content); echo" the link is replaced successfully!
";
At this point, we have completed all the work of capturing the phpquery document content to generate local documents, and also learned the basic operations of phpquery: