When using the session in PHP, the data in session is stored on the server, then the client's information is identified by the SessionID from the client and the information is extracted.
An instance of yourself
The code is as follows
Cases
The code is as follows
Copy Code
$a = 12;function fn (){Global $a;//using outer $a variables, $a as local variables without using this method$a +=12;}echo ' $a = '. $a//output result?>Results of output: $a =24
PHP Instance gzip Transfer page
The code is as follows
Copy Code
Can be used for static resources and HTML pages, which are also suitable for other languagesCache Expiration Time (Cache-control, http1.1), recommended for
What is the reference?
Referencing in PHP means accessing the contents of the same variable with a different name. This is not like a C pointer, but instead, the reference is a symbolic table alias. Note that in PHP, variable names and variable
In PHP, two methods are used to determine whether a value satisfies a condition, and if it satisfies/does not satisfy a different action.
No matter what language you write the program, you will certainly take into account the efficiency of the
Usage of references in PHP:
1. Reference assignment of variables: $a = & $b
2. Reference parameter passing when function call
1 early PHP is a variable that passes a reference type by & symbol when it is invoked, for example: Func (& $arg);
2
Which of the following three types of writing is true?
In the PHP program, what is the naming rule for variables, which of the following three ways is correct?
The 1th kind:$myname = ' AA ';?>
The 2nd kind:$myName = ' AA ';?>
The 3rd
If you do not read the data we directly use the following code, you need to export the relevant data to Excel table can be, such a simple operation does not need to use those class library or something. Directly with the header of the way can
My usual $_server[] variable
$_server[' http_accept_language ']//browser language
$_server[' REMOTE_ADDR '//Current user IP.
$_server[' remote_host '//Current user host name
$_server[' Request_uri ']//url
$_server[' Remote_port ']//port.
Reading data functions
The code is as follows
Copy Code
function Readover ($filename){$file =fopen ($filename, "R");Flock ($file, lock_sh);$filedetail =fread ($file, FileSize ($filename));Fclose ($file);return
Browse page times
The code is as follows
Copy Code
$visited = (int) $_cookie[' pagevisits '] + 1; Setcookie (' pagevisits ',//cookie Name$visited,//Cookie valueTime () +7*24*60*60//Expiration); ?> get and set cookies
The code is as follows
Copy Code
$DM = ' www.111cn.net ';$ip = gethostbyname ($DM);echo gethostbyaddr ($IP);Echo $ip;
Two output results are the same,/*About gethostbyname syntax
String gethostbyname (String $hostname)
function Outpege ($ps tutorial, $page){$ps Cumulative number of information $page the current page number $max the maximum number of lists $min the minimum value of the list$max = ($page >= 5)? $page +5:10;if ($max > $ps) $max = $ps;$min = ($page-5);
There are many methods for paging in Smarty.1. Use the pagination plug-in of Smarty, such as Pager, pagnition, and sliding_page. However, these plug-ins are not very good, and almost all of them have bugs.If you are interested in trial and
For PHP file operations, it is complicated to insert data at the specified position. Let's take a look at the link and insert the data instance in the specified row of the file.$ ArrInsert = insertContent ("array. php", "abcdef", 3, 10 );Unlink
This code comes from the php Tutorial cms and feels very good, so I will share it with you. If you need it, please refer to it./*** File scanning* @ Param $ filepath Directory* @ Param $ whether to search for sub-directories* @ Param $ ex search
The method is to use a matrix. The Chinese character is composed of two ascii characters, one high-bit code and one low-bit code. The boundary is 128-264 64-128, respectively.Each Chinese character Pinyin can contain a maximum of 8 characters, and
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