PHP provides functions that can easily convert various forms of a date to a timestamp, which is mainly:
Strtotime (): Resolves the datetime description of any English text to a timestamp.
Mktime (): Gets the timestamp from the date.
First, the function realization
Example 1:
Copy CodeThe code is as follows:
function Time_tran ($the _time) {
$now _time = Date ("Y-m-d h:i:s", Time () +8*60*60);
$now _time = strtotime ($now _time);
$show _time = strtotime ($the _time);
$dur =
This article mainly introduces the PHP design pattern of the Observer pattern (Observer) detailed introduction and code examples, the need for friends can refer to the following
Intention
Defines a one-to-many dependency between objects, and when
The first time a friend of the PHP language learns some of the PHP destructors might not know much about them. We will give you a detailed explanation of the relevant knowledge in this article. We hope to help you.
Most classes have a special
The read of the CSV large file has been described earlier (PHP reads the code instance of the larger CSV file by line), but there are still some problems with how to quickly and fully manipulate large files.
1, how to quickly get the total number
jquery Uploadify is an AJAX-style batch image upload plugin, in PHP using jquery uploadify is very convenient, please follow the methods and procedures described in this article, for your PHP program to add the jquery uploadify plugin batch upload
The default phpcms is unable to invoke the custom field using the recommended bit, write directly {pc:content action= "position" posid= "catid= DESC" order= "Listorder" 4 "} There is no error, but the data cannot be called, and the blank is
Pclzip is a very powerful PHP class for compressing and extracting zip files, and the Pclzip library is capable of compressing and decompressing compressed archives (WINZIP, PKZIP) in zip format, and can process such files, including generating
In general, the purpose of caching is to put data in one place to make access faster, without a doubt, memory is the fastest, but hundreds of m of data can be stored inside it? This is unrealistic, of course, sometimes temporarily placed as a server
The main use of the U method in thinkphp is to complete the assembly of the URL address, the advantage of using the U method in the template instead of a fixed write dead URL is that you do not need to change any of the code in the template once
Referring to object-oriented first review of the previous programming ideas, the so-called programming is based on the essence of knowledge through the process of logical reasoning procedures, programming ideas, pay attention to the first clear what
PHP uses reference counts and write-time replication (Copy-on-write) to manage memory. Reference calculations ensure that memory is returned to the operating system when the reference is no longer needed, and copy-on-write ensures that no memory is
PHP is not a functional programming language like Lisp, and more, PHP is suitable for writing code in C style. There is no type of "function" in PHP, that is, a function cannot be passed directly with a variable. For example, the following
What exactly is the Zend Framework MVC design pattern?
The core idea of the MVC (Model-view-controller) pattern, the model-attempt-controller pattern, is to divide the entire program code into 3 components that are relatively independent and work
CodeIgniter file Upload class allows files to be uploaded. You can set a file that specifies to upload a file of a certain type and a specified size.
Common process for uploading files:
A form for uploading files that allows the user to
There is such a requirement that an array of $data = Array (12, 43, 87, 45), which requires writing a custom function to separate the numbers of its array elements, and the resulting array is as follows: $data = Array (1, 2, 4, 3, 8, 7, 4, 5). is to
Many times we need to calculate the execution time of the PHP script to learn about the efficiency of the script, and so on. For example, there is a large section of PHP script, we need a fragment to get the script execution time method. First
For PHP references (that is, variables or functions, objects, etc., preceded by the & symbol), let's look at the following procedure.
"; ";//view variable B, also increased by 1, indicating that the same storage unit is used?>
Program
The type casts in PHP are very similar to those in C: precede the variables to be converted with the target type enclosed in parentheses.
The allowable casts are:
(int), (integer)-Converted to integral type
(bool), (Boolean)-converted to
Generic paging Class (tested with CodeIgniter)
page_list.phpCopy the Code code as follows:
/*** Pagination Class*/Class Page_list {
/*** Total Data* @var int*/Private $total;/*** Show data per page* @var int*/Private $size;/*** Current Page* @
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