PHP is still quite commonly used, and everyone knows about its powerful functions. Here we will implement PHP file upload code analysis. PHP is difficult to implement the upload progress bar because when we upload files to the server, we need to
We all know that PHP is an embedded HTML language. PHP is similar to Microsoft's ASP, and it is a script language that is executed on the server to embed HTML documents, the language style is similar to the C language and is widely used by many
PHP code performance optimization 1. Do not copy variables at will
Sometimes, to make PHP code more clean, some new PHP users (including me) will copy the predefined variables to a variable with a shorter name, in fact, the result is a doubling of
We are using1. Use mb_substr of the mbstring extension library to intercept the database without garbled characters.
2. Write the truncation function by yourself, but it is not as efficient as using the mbstring extension library.
3. If you only
Definition
Obtain the length and width of the image.
Syntax:
Array getimagesize (string filename, array [imageinfo]);
Return Value:
Array
Function types:
Graphic Processing
Description:
The PHP function getimagesize can be used to obtain the height
Syntax: void eval (string code_str );
Return Value: None
Function Type: Data Processing
PHP function eval () Description
The PHP function eval () can be used to substitute variable values in strings for processing database data. The code_str
1. open the file: fopen ("file name", "Mode ");
Mode:
R: Read-OnlyR +: read/writeW: Write only. Open and clear the file content. If the file does not exist, create the file.W +: read/write. Open and clear the file content. If the file is not saved,
Through
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 Data Cache class, hoping to help you.
The idea is as
The following describesPHPProgramming statements in the programming language.
1. Simple statement
Each line contains at most one statement, for example:
Reference content is as follows:
$ Argv ++; // correct
$ Argc --; // correct
$ Argv ++;
PHP is a server-side scripting language mainly used for dynamic web page development. It is one of the most popular development languages. Node is a JavaScript toolkit used to write high-performance network servers. The author, Jani Hartikainen,
Regular Expressions match html characters to filter illegal charactersMatch an html Tag. The matching table is as follows:
[Ss] *
Or
[Ss] *?
The above two expressions Add "? "And one "? ", What is the difference?We know "?
Before using ob_flush (), make sure that the preceding content is 4069 characters in size. The output_buffering of some Web servers is 4069 characters or larger by default, that is, the output content must reach 4069 characters before the server
As a new version, PHP5 supports late binding. However, in actual applications, the late binding feature still has some problems. For example, you are using an older version of PHP, then you may find that there is no support for late binding. What we
There are many ways to sort arrays in, including sorting by value, by keyword, and by natural language. What we want to teach you today is to use the PHP function usort () to sort custom arrays. You can create your own comparison function and pass
The alternative to this problem is to rewrite the json_decode and json_encode methods of PHP json.
The solution to the lack of JSON packages for these two PHP files is mainly to convert arrays, strings, or objects into json data (a special structure
In
Shuffle -- disrupt the array:Bool shuffle (array & array)
The PHP function shuffle () is used to disrupt an array (the order of randomly arranged units.
Note: The PHP function shuffle () assigns a new key name to the cell in the array. This will
To add your own
Definition and usage
The PHP function microtime () returns the current Unix Timestamp and the number of microseconds.
PHP function microtime () syntax
Microtime (get_as_float)
PHP function microtime () parameter and description
If
This is just a simple way to traverse arrays. The PHP foreach () function can only be used for arrays. An error occurs when you try to use it for another data type or an uninitialized variable. There are two types of syntax. The second type is
We can use various
Errors may occur in any type of programming, but the PHP framework helps significantly limit these errors. Repeated encoding seems to aggravate this error, and the framework solves this problem. Even so, pay attention to it when
For many other times, we will not use php ftp function file upload, but some advanced WEB applications will use ftp functions, for example, if I want to transfer the uploaded image to server B and save the data to server A, the normal PHP file
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