In our daily development work, we have functions such as getting time, getting date, etc. In our previous courses, we also introduced examples of getting time. Today we will introduce to you the calendar class encapsulated in php, settings and After obtaining the year, month and day, the current date or the date of form submission is displayed. The default setting is the system time. You can also set the time yourself!
The first step is to download the PHP-encapsulated calendar class library we need to use for this course: //m.sbmmt.com/xiazai/leiku/570
Step 2: After the download is completed, find the php class file we need, unzip it to our local directory, and create a new php file!
The third step, after completion, we need to call this class in the new php file and instantiate the class:
<?php include_once "daterili.php";//引入类文件 $calendar=new calendar(); //实例化 $calendar->showDate(); //输出 ?>
Run the file, and the result will be as shown below:
The above is the detailed content of PHP calendar encapsulation code process. For more information, please follow other related articles on the PHP Chinese website!