Using PHP's file_put_contents function to append, it takes a lot of time to write a file in the loop. Because the File_put_contents function opens the file each time, writes the file, and then closes the file.
Here is the test:
Public function
Recently, the company is doing a project, need to crawl to the data to go heavy, the method is based on the data ID, to eliminate the duplicate ID data.
The following is the evolutionary process of this method.
to Heavy$arr _id = Array
This records the information of the common header
Header (' http/1.1 OK '); OK normal accessHeader (' http/1.1 404 Not Found '); Notifies the browser that the page does not existHeader (' http/1.1 moved Permanently '); Set address to be permanently
The code audit contains at least two aspects to first determine the purpose or function of the code, and also to check the readability of the code, that is, more conducive to understanding and maintenance.Maybe you've audited a lot of code, too long
The simplest and most examples of Goolge open source methods
1.google Open API
Cases
The code is as follows
Copy Code
$urlToEncode = "http://gz.altmi.com";Generateqrfromgoogle ($urlToEncode);function
Here to say some, by default, PHP Curl function is not open, so you have to open this function, you need to php.ini in the extension= Php_curl.dll front of the ";" Number removed!!!OK, I'll talk about last night's procedure, although I didn't
Because a program uses output UTF-8 encoding. But the original data is GBK coded.
Baidu found a lot about the internal code conversion classes. But there are many disadvantages. GBK to UTF-8 not supported
But one besides is found in the official PHP
PHP itself provides a number of functions, there is a go out of the duplicate function is Array_unique, this function will remove the same value, so that we can bring convenience to developers, the removal of duplicate values after the length of the
Function for automatically intercepting zblog php summary charactersWhether we are using WordPress or zblog php programs, if most of the default topics are not specially processed, the text section of the summary on our homepage or topic document
1. Enable pseudo-static plug-ins in the background We need to deploy the website, start the "static management center" plug-in "plug-in management" by default, and then we will see "static management center" in the website settings ". Then we set
For example, my http://www.111cn.net/a. php file, I don't want anyone to access it directly from a browser.But if you connect to http://www.111cn.net/a. php from any website, you can accessThe connection established on the local machine cannot be
Function wpjam_minify_Html ($ Html) {return preg_replace ($ search = array ('/\> [^ \ S] +/S ', // delete the space behind the tag '/[^ \ S] + \ ', ' functions. in the php File, the HTML code of the output page can be compressed: [code] if (!
// The most direct html filtering method The code is as follows:Copy code Strip_tags ();// Method 2 use regular expression filteringFunction _ filter ($ string ){Return str_replace (array ("", ''), array ('', ' ', '', '& nbsp;'), strip_tags ($
The code is as follows:Copy code php Tutorial ajax return webpage special effects on data instance Json. php file The code is as follows:Copy code /*************************************** *********************** ** Use a specific function
Dom xml functionsThese functions are only available if PHP was configured with -- with-dom = [DIR], using the GNOME xml library. you will need at least libxml-2.0.0 (the beta version will not work ). these functions have been added in PHP4.This
Actually, this is very simple. Be careful with the following steps:Obtain the latest Apache 1.3 suite at http://www.apache.org/dist/Decompress (ungzip) and untar to the path specified by Apache, such as/usr/local/src/apache-1.3.Edit PHP and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service