Recently, I launched an seo project targeting some excellent websites and turning their resources into our own.
The requirement is: Real-time update, static page localization, and localized pages cannot contain the original themes.
Real-time update and replacement of theme can be implemented by common thieves, but the page must be downloaded for localization. In this way, attention should be paid to a series of problems such as style, image path, and real-time update.
Css, js, images, and other resources must be downloaded to the local device. It is okay to download one or two of these files. Once you download them in batch, you must carefully observe their path rules. In addition, css usually contains background images, this also requires local images. So first, we need to solve the resource localization problem. I wrote a class for the localization of thieves. There are several methods to implement resource localization. Currently, we will first demonstrate the methods for resource localization, the following describes all the code that will be open-source and how to use it:
/*** Generate a folder without generating a file ** @ param $ address */public function get_file_adress ($ address) {// $ first = substr ($ address, 0, 1); $ dirs = explode ('/', $ address); $ this-> array_remove_empty ($ dirs); // $ address = implode ($ dirs, '/'); // if ($ first = '/') $ address = '/'. $ address; $ dirs = array_values ($ dirs); $ nums = count ($ dirs); if ($ nums> 1) {$ s = 0; while ($ s <$ nums-1) {$ dirs [$ s] = self: filename_safe ($ dirs [$ s]); if (! File_exists ($ dirs [$ s]) {if (self: filename_check ($ dirs [$ s]) {if (! File_exists ($ dirs [$ s]) @ $ mkdir = mkdir ($ dirs [$ s], 0777) ;}++ $ s; $ dirs [$ s] = $ dirs [$ s-1]. "/". $ dirs [$ s] ;}}/ *** generate a file ** @ param $ filename * @ param $ url */private function grab_file ($ filename, $ url) {if ($ url = "") return false; if ($ filename = "") return false; // echo $ filename. '| '. $ url. '
Use the get_file_adress function to generate the folder where the file is stored, and then use grab_file to generate the file.
Demo: http://news.80jiaju.com/