A function used to calculate the runtime of the PHP page.
CopyCodeThe Code is as follows: /*
@ Computing PHP
ProgramRunning time
*/
Function microtime_float ()
{
List ($ USEC, $ Sec) = explode ("", microtime ());
Return (float) $ USEC +
CopyCodeThe Code is as follows: // Obtain the current domain name:
Echo $ _ server ['server _ name'];
// Obtain the source URL, that is, click the previous URL on this page.
Echo $ _ server ["http_referer"];
$ _ Server ['request _ URI ']; //
CopyCodeThe Code is as follows: Class foo
{
Private $ name = 'hdj ';
Public Function getname (){
Return $ this-> name;
}
}
Class bar extends foo
{
Public $ name = 'deleka ';
}
$ Bar = new bar;
Var_dump ($ bar-> name );
Var_dump ($ bar->
Added a demo for php implementation to help you understand xgcalendar in php or similar scripting languages. The code may be ugly.
: Http://code.google.com/p/xgcalendar/downloads/list
There is also a demo of gae python version. However, the full
1. Type of input information verification (mainly used to verify the user name, password, repeated password, email address, and other functions)
Copy codeThe Code is as follows: /**
* Validator for Register.
*/
Final class RegisterValidator
/* PHP Regular Expression extraction Any attribute in the image img mark */$ Str = ' PHP Regular Expression extraction or image change img any attribute in the tag ';
// 1. Retrieve the entire image codePreg_match ('/] *? Src \ s * = \ s * (\ '| \
Fsockopen spoofs the post and get methods. If you are looking for php processing code that spoofs the post and get methods, this is good.
Copy codeThe Code is as follows: // Fsocket simulate post submission
$ Purl = "http: //
Introduction PHP is a very surprising language. It is powerful enough (the core language of the largest blog (wordpress) and extensive enough (running on facebook, the largest social networking website). It is simple enough (as the preferred
If you have just started learning PHP, there may be many functions that need to be studied. Today we will learn how to use PHP Header (). For more instructions, please refer to the PHP Chinese manual. The following describes how to use the header
Let's look at the following code. Can you find out where the error is?
Copy codeThe Code is as follows: Echo function_exists ('addcslashes'); // checks whether the function exists.
Echo get_magic_quotes_gpc (). ''; // checks whether automatic
Is there any way to automatically clear temporary folders?
The following code is a php code that cleans up files in a folder at regular intervals.Ps: this code will continue to be executed without restarting the website, so it is only used for
Similar_text-calculate the similarity between two strings
Int similar_text (string $ first, string $ second [, float & $ percent])
$ First is required. Specifies the first string to be compared.
$ Second is required. Specifies the second string to
Is_numeric: checks whether it is a numeric string, which can be a negative number or a decimal number.
Ctype_digit: checks whether all characters in a string are numbers. Negative and decimal digits cannot be detected.
Note that the parameter
1. General Cache Technology:
Data Cache: The data cache here refers to the PHP cache mechanism for database queries. Each time you access the page, it first checks whether the cache data exists. If it does not exist, it connects to the database,
Apache server optimization, PHP optimization, and Mysql Optimization
1. Use eaccelerator
We have introduced the optimization of the Apache server. If you have browsed the PHP web page, you may find: How does PHP speed slowly? What is the matter? Isn'
Package download
Pain. phpCopy codeThe Code is as follows: Class Pain{Public $ var = array ();Public $ tpl = array ();// This is the method to assign vars to the templatePublic function assign ($ variable, $ value = null){$ This-> var [$ variable] =
An existing function and object are as follows:
Copy codeThe Code is as follows: var doubling = function (x ){
Return x * 2;
};
Var obj = {
Val: 100,
};
In function call mode, this is bound to a global object. In this case, the object
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