The iconv function is used to convert the captured UTF-8 encoded page into gb2312. it is found that only the iconv function can be used to convert the captured data into less data for no reason.
The iconv function is used to convert the captured UTF-
Function name: ReplaceSpacialChar ($ C_char) function: special character replacement function parameter: $ C_char (string to be replaced) return value: string remarks: This function is faulty,
Function name: ReplaceSpacialChar ($ C_char)
Usage:
This function is powerful. it is much more powerful than the built-in functions in php. This function can automatically obtain your character encoding and convert it to the encoding you want based on your reference, the code is as follows:
This
Today, a customer needs to generate 400 phone numbers in batches at the starting position of 10000. at the beginning, I directly generate a number such as 10004, but merchants do not like this number, here, we can use substr ($ str,-1) 4 to filter
Because the Chinese character is two bytes, it cannot use substr () in the same way as the English and numbers. Fortunately, there is a mb_substr () function in php to handle this problem.
Because the Chinese character is two bytes, it cannot use
$ Str & amp; 39; today is very Happy. all of you decided to go to KFC to eat cool chicken wings !!! & Amp; 39; * $ str is the string to be intercepted $ len is the number of characters to be intercepted * functionutf8sub ($ str, $ len) {if ($
$
You can use ini_set to quickly modify the phpini configuration settings. you do not need to open phpini, especially when you do not modify the permission of phpini on the VM, you will find this function
You can use ini_set to quickly modify php. ini
Yesterday I used the file_get_contents function directly when I was doing a simple collection function. However, some websites were okay to collect some network chips. later I analyzed that garbled code was enabled by the server.
Yesterday I used
In php, the file_get_contents function can directly collect remote server content and save it to a variable. Generally, I/O operations such as file_get_contents and fsockopen are involved.
In php, the file_get_contents function can directly collect
In PHP50, simplexml_load_file () is a good function for reading and processing XML files, but garbled characters occur when reading and processing Chinese files. after research, it is found that if it is Chinese content, it must be converted by
The data parsed by the problem is incomplete. there are blank fields. I checked it online and said that there is a bug in php528. the solution is to use a custom function. the code is as follows:
The data parsed by the problem is incomplete. there
& Lt ;? * | A simple counter * functionget_hitcount ($ counter_file) {* returns the counter to zero. if the counter is not used, the initial value is 1. you can also set the initial value
/*
| A simple counter
*/
Function
I have been using a self-defined number formatting method before. It turns out that PHP has always had a number formatting function ~ For example, echonumber_format (285266237); you can output 285
I have been using a self-defined number formatting
Several character truncation functions are provided for us in php, including substr, mb_substr, and mb_strcut functions. some php beginners use substr to intercept Chinese characters and find Chinese characters contain garbled characters, we can use
The functions of these two functions are the opposite. The chr function returns characters from the specified ASCII value, while the ord () function returns the ASCII value of the first character of the string. You can use this letter to understand
The url address verification function in php of an instance. the code is as follows: function name: CheckWebAddr ($ C_weburl): determines whether the parameter is a valid url: $ C_weburl
The url address verification function in php of an instance.
The mt_rand () function is used to generate a random number. the average speed of this function to generate a random number is four times faster than rand. The flip method is used to remove repeated values in the array, that is, the array_fl
The
The article details the differences between print_r, var_export, and var_dump in PHP and their usage in different php applications. it can be seen that both print_r and var_export are
This article describes in detail the differences between print_r,
First, let's take a look at the ob_start usage and use the PHPob_start () function to open the browser cache. This ensures that the cache content is completed when you call flush (), ob_end_flush () (or the program execution is completed.
First, let'
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