PHP Get Date:
Date_default_timezone_set (' PRC '); Default time zone
"Today:", Date ("Y-m-d", Time ()), "<br>";
"Today:", Date ("Y-m-d", Strtotime ("June")), "<br>";
"Yesterday:", Date ("Y-m-d", Strtotime ("1 day"), "<br>";
"Tomorrow:", Date ("Y-m-d", Strtotime ("+1 Day"), "<br>";
"One week later:", Date ("Y-m-d", Strtotime ("+1 Week"), "<br>";
"2 days a week four hours two seconds later:", Date ("Y-m-d g:h:s", Strtotime ("+1 Week 2 Day 4 hours 2 Seconds"), "<br>";
"Next week Four:", Date ("Y-m-d", Strtotime ("next Thursday")), "<br>";
"Last Monday:". Date ("y-m-d", "Strtotime"). " <br> ";
"One months ago:". Date ("Y-m-d", Strtotime ("last month")). " <br> ";
"One months later:". Date ("Y-m-d", Strtotime ("+1 Month")). " <br> ";
"Ten years later:". Date ("Y-m-d", Strtotime ("+10 Year")). " <br> ";
Array Length: count ();
Random number: rand ($min, $max);
Open the file with fopen, with the feof loop to read the file, each time with the Fgets method will only read a row, only each call fgets method will let the reading data cursor down one line, so if you do not need to read all the words can be read again, Use continue to jump out of the loop when not needed
When you open a file with fopen and write to the content with Fwrite, a new file is created automatically if the file does not exist
In CL:
$this->db->where ("$search between Start and end", null, FALSE);
The first parameter is the SQL statement, the second argument is empty, and the third parameter indicates whether $search is added to provide protection, and if quotation marks are added, this $search is the field name or table name, etc.
The Ip2long () method converts the IP into a digital
Long2ip () Convert numbers to IP
PHP regular match:
Match a number in a $str
$str = "memtotal:502216 KB";
Preg_match (' # (\d+) # ', $str, $matches);
echo $matches [0];//output 502216
Regular validation, which returns TRUE or False
Mb_ereg ("^[\w\-\.") {1,32}$ ", $str)
The above content is I in the actual study development summary and record, for reference!
PHP Small Note