Share a very practical, I have been using the PHP pop-up warning function, sorted into their own code base in the encounter where the error can be used to the function, extensibility, complete code as follows
Copy Code code as follows:
Pop-
PHP recursive function in the use of return when you can not correctly returned to the desired situation, if you do not understand the reasons, it is difficult to find the wrong, the following specific examples to illustrate it:
Copy Code code
Copy Code code as follows:
$str = ' ASB Tianshui 12 ';
if (Preg_match ("/^[\x7f-\xff]+$/", $str)) {
Echo ' All is Chinese character ';
}else {
Echo ' is not all Chinese characters ';
}
/**
PHP's own judgment is Chinese,
Eregi (' [^\x0
Copy Code code as follows:
/**
* Convert a string to an array
*
* @param string $data strings
* Returns the array format @return array, and returns an empty array if data is empty
*/
function String2array ($data) {
if ($data = = ")
Recently to do a collation of the site, you need to detect which pages are not Baidu search engine included in the relevant adjustments. Because the use of SITE commands to see is really is not to see, think of the use of PHP program to batch
In order to prevent their hard-earned webapp by people copy, we all want to limit the program can only be in the micro-letter inside browsing, although the following implementation of this function, single is a vegetable, no technical content,
In many systems environment everyone will use the letter combination of various coding, the following recommendations are very useful PHP code.
$num are grouped by several letters.
$s letters contain capitalization and can be leveled in
Nonsense not much to say, directly look at the code:
Copy Code code as follows:
$DBH = new PDO (' Mysql:host=localhost;dbname=test ', "test");
$query = INSERT into ' user ' (' username ', ' password ') VALUES (: username,:p
Copy Code code as follows:
$long = "Big_long_variable_name";
$ $long = "PHP"; /* Use the string stored in the variable $long as the variable name for the new variable, equivalent to $big_long_variable_name= "PHP"; */
$short =& $big
Install Redis on Mac OSThe first is the installation, which will be installed by default to/usr/local/bin
Copy Code code as follows:
Cd/tmp
wget http://redis.googlecode.com/files/redis-2.6.9.tar.gz
TAR-ZXF redis-2.6.9.tar.gz
CD
PHP itself does not provide a function to return the number of milliseconds, but provides a microtime () function that returns an array containing two elements, one in seconds and the number of milliseconds in decimal notation, which makes it easy
Load bottlenecks are generally mainly in the following four areas:
1 database
2 Server CPU
3 hard disk I/O
4 Network bandwidth
Except for these four. What else is worth our optimization? PHP is really strong. Today, the PHP script level to adjust
Function:
1. Get the url,email,image in the content.
2. Replace the url,email,image in the content.
Url:xxx
Email:admin@admin.com
Image:
Grep.class.php
Copy Code code as follows:
/** grep class
* DATE:2013-06-15
*
Error Tip: Warning:session_start () [Function.session-start]: Cannot send session cache Limiter-headers already sent
Reason: error if there is output before session_start (),
Solution: add Ob_start () before Session_Start ();
index.php
Copy
Html
This example assumes a dynamic display on the page (no need to refresh the entire page, but only local refresh dynamic numbers) The current number of online users, commonly used in some statistical platforms. You only need to define the
This article describes a switch that uses jquery, PHP, and MySQL to implement a 360 security guard firewall on and off, which can be applied to the turn on and off features of a product feature.
Preparation for a better demonstration of this
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