You can obtain and subtract the start time and end time of the page through the commonly used microtime (). The calculation result is a period of time that the page has been running, however, this is not necessarily the time when the page is running.
PHP can automatically perform memory management to clear unnecessary objects. PHP uses reference counting, a simple garbage collection mechanism. Each object contains a reference counter. Each reference is connected to an object, and the counter is
In php, we usually use mysql session to log on. The following is an example of how to use php + mysql + session to log on to the instance, for more information, see.
Instance
The Code is as follows:
Copy code
// Remove
After installing the memcache module for php, check the description file of the module and find that it can also be used directly as the php session handler without additional encoding.
The setting method is simple. You only need to modify the
Referenced files are different from files referenced in asp in php. I will introduce using require and include to reference file instances in php.
Referencing a file is one of the major characteristics of PHP. This method can put common functions
In php, the process control statements include the while, for, if, switch, foreach, and declare statements. The following describes how to use the process control statements, I hope this method will be rent out to all of you.
In PHP, a flow control
There are several reasons for Chinese garbled characters on PHP pages. One is that the page encoding is not counted. The other is that no encoding is set in the database. The third is that there is a problem with apache encoding, the following two
If PHP5.5 is used in a linux system, you may find that json_encode cannot be called after it is installed and upgraded to PHP5.5. This is not a version issue, but it is an incorrect operation process. The solution is simple.
After installing php5.5
At school, our teacher told us that there will be many algorithms for program data sorting. In fact, the bubble algorithm is a commonly used sorting algorithm. Next I will use php to Implement Bubble sorting, and record it below.
Example 1
Next, I will introduce you to a php file to get the address of the video swf player on the Youku Tudou page. If you do not have enough temporary information, please share it with me.
The Code is as follows:
Copy code
The
If your webpage shows 301 or 404, it is a very serious problem for the user experience, so we must be careful when doing php header301 or 404, let me take a look.
301 jump
The Code is as follows:
Copy code
Header ('HTTP/1.1 30
There are many ways to filter out special or invalid characters in php, such as the regular expression str_replace, which is a good method, such as carriage return, space, line breaks can be solved with it.
A nearly responsible system module is
Cookies are commonly used in php, but many friends may not know how cookies work, the following small series will help you sort out the working principles of php cookies and some examples of cookie read/write operations.
Cookie and session
This php image and Verification Code Generation Principle code is supported by the php gd library. If your system cannot create an image, set gd. before dll; then, restart apache. If it is iis, restart iis.
ThisHow php creates images and
This article provides a php course Chinese Character Verification Code Generation Program. If you want to generate Chinese Characters in an image, you need the font file and the imagettftext function. If you want to use it, search for it online. If
Php and mysql are inherently a pair. Next I will introduce how to call the stored procedure written in mysql in the php program. Let's take a look at the specific implementation methods.
Mysql stored procedure creation syntax
The Code is
The difference between the constant equal operator and the comparison operator "=" is that "=" does not check the type of the conditional expression. The constant equal operator checks the value and type of the expression at the same time.
This is
This article introduces the usage of parse_url () function in php. If you need parse_url () function, refer to this article.
A useful function in PHP, parse_url, is particularly convenient for information capture analysis. For example:
The
In php, array_multisort () can sort multiple arrays at a time, or sort multi-dimensional arrays based on one or more dimensions. If the result is successful, TRUE is returned, and FALSE is returned if the result fails.
Bool array_multisort (array ar1
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