"Purpose": Converts the interface of a class into another interface that the customer wishes, and the adapter mode makes it possible to work together because the interface is incompatible and cannot work together
"Primary Role"
Target role:
1. unset ($_session[' xxx ') deletes a single session,unset ($_session[' xxx ')) to unregister a registered session variable. The effect is the same as Session_unregister ().
Session_unregister () has been discarded in the PHP5.
Unset ($_session)
Get IP Address
In PHP to get the current visitor's IP address, or relatively simple:
$ip = $_server[' REMOTE_ADDR ']
The above IP sometimes get no real IP address we can operate as follows
$ip = GetIP ();
Convert IP to city and other
This article mainly introduces the chain operation example of PHP implementation. People who write programs like to be lazy, want to play a few lines of code, and make the code look cool.
It's like a lot of little friends are writing if...else ... ,
Example. Const constant Access
The code is as follows
Copy Code
Class Math {Const num=3.14;Public Function Shownum () {return self::num;}}echo Math::num. " ";$math =new Math ();echo $math->shownum ();Results:3.143.14
Example.
The code is as follows
Copy Code
$test = 0;if ($test = = ") {Echo ' in php, 0 is empty '; is output}if ($test = = = ") {Echo ' in php, 0 is empty '; Not to be output}if ($test ==null) {Echo ' in php, 0 is
Pass Value:
The function parameter pressure stack is a copy of the parameter.
Any modification is a function on the copy and does not work on the original variable.
Pass Reference:The press stack is a copy of the reference. Because a reference is
A recent project on the timeline, giving a start time and an end time, you need to list the dates in this time period and also determine how many weeks. After research, come up with the following methods, and we share, to facilitate the need for
PHP fastcgi process Manager, compared to fastcgi static evoke CGI,FPM can dynamically invoke the CGI process and destroy to reach the dynamic adjustment CGI number according to the access pressure, so that memory can be used effectively. There are
Ecshop often error $data undefined. Cause the whole station fatal error! After analysis, the file shop_config.php write failed. The data size is 0. Thus affecting the entire station can not visit! This kind of mistake is very fatal!Solution:Turn on
Bool curl_setopt (int ch, string option, mixed value)The curl_setopt () function sets options for a CURL session. The option parameter is the setting you want, and the value is the value given by this option.Forged loginThe user data on both sides
Definition and usageThe sprintf () function is used to write formatted strings into a variable.SyntaxSprintf (format, arg1, arg2, arg ++) parameter descriptionFormat is required. Conversion format.Arg1 is required. Specifies the parameter inserted
Processing of file upload forms The code is as follows:Copy code Let's take a look at the usage of files variables.The $ _ FILES Super global variable is special. It is the unique two-dimensional array in the predefined Super Global array.
Export the variables from the PHP array and register them as global variables. The key name is used as the variable name and the value is used as the variable value, as shown below: The code is as follows:Copy code $ Vars = array ('var1' => '1',
Let's not talk about the instance first.#1 array_unshift () example The code is as follows:Copy code $ Queue = array ("orange", "banana"); // defines an arrayArray_unshift ($ queue, "apple", "raspberry"); // Insert an element to the arrayPrint_r
$ Fp = fopen ("test.txt", "r ");// Open the file in read-only mode and point the file pointer to the file header$ Fp = fopen ("test.txt", "r + ");// Open the file in read/write mode and point the file pointer to the file header$ Fp = fopen
/Mixed str_replace (mixed $ search, mixed $ replace, mixed $ subject [, int & $ count])Return a string or replace the given array replacement value in all searches in case of a problem.If you do not like rules to be replaced (such as regular
After reading the article "how to call the Asscess database and COM program through ADO in PHP", I immediately did the test and the result failed. Sad.What should I do? I had to go to the official PHP website for help, and Huang Tianyan had no
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