Objective
PHP itself is already a very fast language, but in addition to the speed of execution, PHP There are still many places that can be optimized.
In this article we will introduce some of the following:
1. why There are many factors
monkeyserve.com Free unlimited capacity, unlimited flow of web space, support PHP tutorials, CGI, provide unlimited MySQL tutorial database tutorials, unlimited PostgreSQL database, unlimited free mailbox, limit 20 concurrent connections, Support
Method One
sprintf () function, the sprintf () function writes the formatted string to a variable
The code is as follows
Copy Code
$num = 123213.666666;Echo sprintf ("%.2f", $num);
Example 2
The
Let's take a look at the exact application of the regular expression meta character./fo+/Because the preceding regular expression contains a "+" metacharacters, it means that a string of one or more letters O can be matched with the "fool", "fo", or
First look at the Array_multisort () function
The code is as follows
Copy Code
$ar = Array (Array ("A", "one, One,", "a"),Array (1, 2, "2", 3, 1));Array_multisort ($ar [0], SORT_ASC, sort_string,$ar [1], sort_numeric,
Use PHP to invoke the Linux command line, execute the compression command, OK, move now!
/* split into 3 txt files are wow_1.txt wow_2.txt and wow_3.txt all placed under exl_file directory * *
The code is as follows
Copy Code
PHP is a great web development language, flexible language, but see the PHP programmer repeatedly made some mistakes. I did the following list, listing the 10 bugs that PHP programmers often make, most of which are security related. Look how many
Array_merge ();
Merges two arrays, if the key name of the array is a character, and the key names of the two arrays are the same characters,
Such as
$array 3=array ("Gender" => "male", "name" => "not Woman");$array 4=array ("Gender" => "Do not
I have referred to the Internet many IIS under the installation of PHP articles, are php.ini and a bunch of. dll, a person has a person's argument, a mess, many of the installation tutorial writers themselves do not know how to handcuff these things,
Smarty is a semi-official template engine for PHP, as you can see from its home page location. The use of simple, powerful, this article describes the Smarty template installation and use.
1 now the template installation package, extracted to a
Some regular expressions commonly used in the work are sorted out, and regular validation expressions are commonly used:
Number-related regular expressions
Number: ^[0-9]*$N-bit fixed-length number: ^\d{n}$Number between m-n bits: ^\d{m,n}$Numbers
PHP is often used in the development of the URL to pass parameters, to pass the parameters of security filtering, filtering the illegal parameters of the URL, this is a small PHP security, but it is a matter of security. URL parameters are usually
Gw.php sets the size of the uploaded file, which needs to be changed in three places.1. nginx. confClient_max_body_size is 2 MB by default. If the http Upload exceeds 2 MB, the error 413 Request Entity Too Large will be reported.Solution: increase
After being instructed by online users and then tested locally, we finally found that the php version was a problem. The linux environment was php5.4.20.After searching for the solution, I found the solution by reading the "2. dedecms Post prompt"
Generally, this problem occurs on unix servers. Due to restrictions on the PHP configuration of your site, the program attempts to perform directory operations using FTP. You must specify FTP-related variables in the background,Solution:Modify
Batch setting of articles and columns as only dynamic browsing: (the "system" SQL command line tool in the background)1. Set all documents to "dynamic only ":Run the following mysql tutorial statement:Update dede_archives set ismake =-12. Set all
Today, I processed a Project Server monitoring task and tested whether the value of the metric item was valid through zabbix_get. I found a php error:[Root @ ipxxxxx ~] # Zabbix_get-s 1.1.1.1-k MySQL. Threads-runningPHP Warning: Module 'gd 'already
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