1 build from the simplest array in PHP:
1) Common functions:
Generate random Number:
1 Echo Rand (1,10); // two parameters to determine the range of a random number 2 Echo Rand (ten);// be treated as his seed, i.e. cannot give only one parameter
The result of 2 is (missing a parameter)
2) Date-time function
<?phpvar_dump (Time ());//Unix timestamp of the current time?>
This shows the result:
Example: Similar to this (provided that the value returned with the Var_dump () output)
The right way is
* Year (four digits) with uppercase Y, month months with lowercase m, days day with lowercase d middle space hour H (12 hour system) minutes I seconds S specific subdivision suggest using PHP reference book
<? PHP Echo Date ("Y-m-d h:i:s",Time ()):?>
The result of the output may not match the time you want to see (with computer time immediately)
So here's the question.
There are generally two situations
1)
A similar form appears and that's probably you. Database (Wampserver)
Specifically, the second possibility
2) The return time and the actual difference is too large, this situation may be the time zone is not set.
Two types of solutions
A, although this method is easy to write, but too restrictive. Every place (page) needs to be changed
1 <? PHP 2 date_default_timezone_set (' PRC '); 3 Echo Date ("Y-m-d h:i:s",Time()) 4 ?>
b, modify the configuration file
Open PHP. INI lookup (ctrl+f) "Date.timezone" to make it "etc/gmt-8" after the equals sign
Just remember to save (CTRL + C) if not yet, restart your database. Completed
At the same time, another way to take the current format
Echo Date("y-m-d h:i:s ") //Save time for 2nd parameters
PHP Learning notes Array and data structure 1 (Date time function and problem solving)