CopyCode The Code is as follows: // capture the string length. UTF-8 and gb2312 encoding are supported. If it is gb2312, convert it to UTF-8 first, extract it based on UTF-8, and then convert it back.
Function cut_string ($ STR, $ from = 1, $ length
The following is an excerpt:
If we design the topic table and reply table, the common practice is as follows.
In this way, you can directly use the paging algorithm to extract topics when obtaining the topic list. When viewing a post, you also
1. obtain remote filesSource code(File_get_contents or fopen ).2. AnalysisCodeGet the content you want (regular match is used here, usually pagination ).3. Download and import the content obtained from the root, and perform other operations.
Here,
CopyCode The Code is as follows: // Range is an array of columns from 1 to 100.
$ Numbers = range (1, 1,100 );
// Shuffle will immediately disrupt the array order
Shuffle ($ numbers );
// Array_slice retrieves a segment of the array
$ NO = 6;
$
The following is a simple implementation method for the recent pop-up:
1. Simple implementation of Color Words
CopyCode The Code is as follows: Header ("Content-Type: image/PNG ");
$ Text = $ _ Get ['T'];
$ Font = 'stxingka. ttf'; // TTF font
$
Official Manual (http://us.php.net/manual/en/function.natsort.php)
CopyCode The Code is as follows: bool natsort (array & $ array)
This function implements a sort algorithm that orders alphanumeric strings in the way a human being wocould while
1. Preface
Paging display is a very common method for browsing and displaying large amounts of data. It is one of the most common events in Web programming. For web programmers
Code It is as natural as breathing, but for beginners, they often have
PHP has $ _ Get, $ _ post, but no $ _ Put, so if you need to use it, you have to simulate it yourself:
CopyCode The Code is as follows: $ _ Put = array ();
If ('put' = $ _ server ['request _ method']) {
Parse_str (file_get_contents ('php: // input')
If you use file_get_contents directly, an error is returned;
CopyCodeThe Code is as follows: $ url = (https://xxx.com ");
File_get_contents ($ URL );
Error:Warning: file_get_contents (https://xxx.com) [function. File-get-Contents]: failed to
If the traffic volume is large, it will cause a great burden on the database. Therefore, it is necessary to cache PHP Data for infrequently changed content, I made a simple PHP "File Cache" class, hoping to help you.
The idea is as follows:
The following figure shows that the interference code is not enabled.
The following is the class code
CopyCode The Code is as follows: /*************************************** *********
// File: imagecode
// Done: dynamic verification code
ArticleDirectory
Or
First, describe some of my parameters:Operating System: Windows 7 UltimateWeb server: Apache 2.2.14Visual Studio: 6.0 (do not abandon the old version, even in win7 it can still be used, of course you can use
PHP has been quickly promoted with ease of use, but it is not easy to use it. In fact, many
Program It is easy for people to build Web application systems, but how many people have carefully considered their
Code Is it easy to maintain, robust,
We often see many strange PHP syntaxes In the templates of wordpress blog programs, such:
Copy codeThe Code is as follows:
Empty
For a considerable number of PHP enthusiasts, what are these things? Are those blog developers doing their own
1. Generate a random number
Use the for loop to generate several random numbers.
Use a random function to generate a random number within the specified range. For example, rand () generates numbers between 1 and 15.
Use a hexadecimal function to
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