Variables are an essential part of PHP programming, in PHP variables are divided into global variables and private variables, the following to share my knowledge of PHP variables and usage, we can refer to the reference.
If you have a definition of
First you need to connect to the MySQL database via PHP:
#连接数据库
The following is the simplest code for PHP to connect to the MySQL database:
The code is as follows
Copy Code
$link =mysql_connect ("localhost",
This article to introduce the PHP implementation of 301 permanent redirection will not take the WWW domain name to the domain name with WWW, the implementation method is obtained.
When your site domain name changes or Web address changes (changes in
Arithmetic Operators
1, arithmetic operators: + 、-、 *,/,%.
2, Increment/decrement operators: such as $a++, $a--, + + $a,--$a.
Such as:
The code is as follows
Copy Code
$a = 10;$b = 5;$c = $a + +; The value is
You can use the common microtime () to get the page start and end time and subtract, the result is the page runs a period of time, but this is not necessarily the time the page itself run
copy code
!--? php//instance:
MySQL database is divided into two types, one is the traditional data table format, one is to support transaction processing data table format (INNODB,BDB, which is dominated by InnoDB), let me introduce the MySQL transaction processing database
I remember the first time I approached CGI, it was curious and strange. Now have been able to write their own program, but this is also a tortuous in the middle of the detour, now I am also very able to understand some novice face 500Internal Server
Recently, data statistics were calculated using PHP's MONGO extension, which had a timestamp field that was 13 bits long because it was accurate to milliseconds, but because it was stored as a string at the beginning:
The code is as
In the programming language I know about function, this command is used to define functions, so let's look at the use of functionality in PHP.
User-defined functions are also called custom functions, which are not provided by PHP and are created by
In PHP, the use of the header function is very large, the header can not only send the original HTTP header information to the client, but also directly implement the file download operation, the next small series to introduce you welcome friends
In PHP, there are a number of methods to judge the string is empty, such as equal to the empty = = Null,empty,isset can be used to determine whether a variable or string is empty oh, I would like to give you friends to introduce.
string; Determines
This is the simplest PHP introductory tutorial, we just know a few common functions can be implemented to delete the last character of the string, if Substr,rtrim and so on.
The original string 1,2,3,4,5,6,Remove the last character "," and the end
This article introduces the basic tutorial of drawing class, interface, final, and class constants in PHP, and you can refer to the friends who need to know. PHP Object-oriented
First, the extraction class (abstract)In our actual development process,
In PHP to get the file modification, the creation time we can directly use the Filemtime () function, which can return the file content last modified time.
If successful, the time is returned in the form of a Unix timestamp. If it fails, it returns
PHP is the weak type where you do not need to define a variable type when you use the edge to the number definition type, you give the variable what type of variable is automatically what type.
In PHP, the types of variables are determined by the
In PHP sometimes we want to get the extension of the upload file, below I summarize the extension in PHP to get a summary of the method, there is a need for friends to refer to.
Method One, my own most kind of get extension method
The
Cookies are a kind of thing that happens in all program development, let me introduce the cookie setting (Setcookie) removal ($_cookie) login usage.
1. Set Cookies
PHP uses the Setcookie function to set cookies. It is important to note that a cookie
The static keyword is to describe the member property and the member method is static in the class, the application of the final keyword can only be used to define the class and the definition method, and cannot use the final keyword to define the
Constellation judgment is very simple we want to count all the date and time of the week, and then get the date to query can be, the following I give you two examples, the need for students to reference.
Constellation: I wrote it on this schedule,
How to understand scopes in PHP, let's look at local variables: variables declared inside a function. Global variables: Variables declared outside the function for detailed instructions
7.2.8 local variable into global variable
The code
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