Brief introduction
Here are some basic tips to get your PHP site running faster.
1. Using gzip
Add the following code at the top of each PHP page:
With this code, the server compresses all the code that needs to be routed to the client
There are a number of ways to replace strings in PHP, and str_replace is more common, but the Preg_replace method may be used in a more complex way.
These two methods (Str_replace and preg_replace) have a disgusting difference in the problem of
Phpmailer is a powerful PHP-written mail-sending class that makes it easier to send messages, send attachments and HTML-formatted messages, and use an SMTP server to send messages.
You may be asked, PHP is not already built-in mail () function, why
If you want to traverse all files (including subdirectories) in a directory, the first idea is to use recursion: Process the current directory first, and then process the subdirectories under the current directory. Can you do it without recursion?
Now many PHP programs need to zendoptimizer environment, but Zendoptimizer after PHP5.2 has been supported, then what to do, Zend will not do so, originally PHP5.3 began zendoptimizer formally changed to Zend Guard Loader.
Zend Guard Loader is
During the project development process, the operation of the database is often encountered in the process of table structure, stored procedures and other modifications, when the general operation is done directly in SQL Server Enterprise Manager in
What file is PHP?
PHP, a nested abbreviated name, is an abbreviation for the English "super Text Preprocessing language" (Php:hypertext preprocessor). PHP is an HTML embedded language, PHP and Microsoft's ASP quite a bit similar, is a server-side
In the development of PHP program, many developers did not notice the difference between $globals[] and global, these two kinds of writing is actually very different, not just the literal above differences, let me look at their specific differences.
PHP Instance code: Time-friendly formatting, see the code:
Copy to ClipboardWhat to refer to:
[www.bkjia.com]
Class DateFormat
{
private static $_diff_format = Array (
' Day ' = '%s days ago ',
' Day_hour ' + '%s day%s hours ago ',
' HOUR ' = '%s
PHP uses Preg_replace and preg_match to filter sensitive words
Code Listing 1:
Copy to ClipboardWhat to refer to:
[www.bkjia.com]
$badstring = "tmd| | tnnd| her mother's ";
$string = "What the hell you say, her Niang, not human";
echo preg_replace (
PHP formats the date usage code, including the leading 0 example:
Format character description return value exampleDay of the D month, 2 digits with leading zeros 01 to 31The day of the D-week, the text says, 3 letters Mon to SunDay of the J month,
Baidu a bit about PHP gets the variable name method is the following function. But I found a bug with it.
/*** Get variable name** @param $string* @return $string** $test = "Helo";* $test 2 = "Helo";* Getvarname ($test 2);*/Function Getvarname (&
Build a virtual host on your own computer? Fully controlled by oneself, and to support what has what, self-configuration.
Building PHP is not very difficult, just a bit cumbersome. It's time-consuming to build your own PHP + MySQL environment. To
1 mathematical operations can be applied directly to the variables in the template tag
{$foo+1}
{$foo*$bar}
{if ($foo+$bar%$baz *134232+10+ $b +10)} ... {/ if
2 Get,post,server,sessiom,cookies and other page
1. If a method can be static, declare it static. Speed improvement are by a factor of 4. If a method is static, it is statically declared. The rate can be increased to 4 times times.
2. Echo is faster than print. echo is faster than print.
3. Use
Help Home Tutorial Pchart is an open source chart generation library, mainly involving 3 Class:pChart.class, Pdata.class, Pcache.class, can generate more than 20 kinds of simple or complex charts, support Png,jpg,gif general image format. The data
If you do not want to let others know that your website uses PHP program to achieve security purposes. You can configure your httpd.conf file as follows.
You can use the following method to achieve the hidden purpose:
1. Hide PHP as a different
Original: http://nettuts.com/articles/10-principles-of-the-php-masters/
With the popularity of PHP, you can easily find a piece of code to achieve the desired function, but what kind of code is a good code? At this point, we need the guidance of
Help Home (www.Bkjia.com) tutorial PHP image Watermark Effect Instance code
The following is the referenced content:
$backFile: Background map$copyFile: Images to be copied$resultFile: Generate File Save address$copyToX: Copy
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