开源的PHP+mysql:第10讲时间函数及文件上传.pptVIP

  • 7
  • 0
  • 约5.08千字
  • 约 21页
  • 2017-06-05 发布于湖北
  • 举报

开源的PHP+mysql:第10讲时间函数及文件上传.ppt

第10讲 日期函数和文件上传 (12、15章) 课前回顾 窗体处理与URL参数(重点) 网页窗体的用途 HTML标签建立网页窗体 $_POST与$_GET结合数组变量 URL参数传递数据 常用Html标签(掌握) 文本框,密码框,文本区域框 单选框,多选框,下拉框 本节内容 日期和时间函数 常用的日期和时间函数 处理日期和时间 文件上传 文件上传的相关函数 文件上传示例 10.1.1日期和时间函数 函数:string date ( string format [, int timestamp] ) 说明:返回将整数 timestamp 按照给定的格式字串而产生的字符串。如果没有给出时间戳则使用本地当前时间。参阅教材201页查看此函数的格式化参数内容 ?php date_default_timezone_set(‘PRC’); //设定时区 // 假定今天是:March 10th, 2001, 5:16:18 pm $today = date(F j, Y, g:i a);?????????????????// March 10, 2001, 5:16 pm $today = date(m.d.y);?????????????????????????// 03.10.01 $today = date(j, n, Y);???????????????????????// 10, 3, 2001 $today = date(Ymd);???????????????????????????//$today = date(\i\t \i\s \t\h\e jS \d\a\y.);???// It is the 10th day. $today = date(D M j G:i:s );???????????????// Sat Mar 10 15:16:08 $today = date(H:m:s \m \i\s\ \m\o\n\t\h);?????// 17:03:17 m is month $today = date(H:i:s);?????????????????????????// 17:16:17 ? 10.1.1日期和时间函数 函数:array getdate ( [int timestamp] ) 说明:返回一个根据 timestamp 得出的包含有日期信息的结合数组。如果没有给出时间戳则认为是当前本地时间。 ?php $today = getdate(); print_r($today); ? 10.1.2 处理时间 函数:int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year ]]]]]] ) 说明:根据给出的参数返回 Unix 时间戳(January 1 1970 00:00:00 GMT)。 ?php echo date(M-d-Y, mktime(0, 0, 0, 1, 1, 1998)); echo date(M-d-Y, mktime(0, 0, 0, 1, 1, 98)); ? 10.1.2 处理时间 函数:int time () 说明:返回自从 Unix 纪元(格林威治时间 1970 年 1 月 1 日 00:00:00)到当前时间的秒数。 ?php $nextWeek = time() + (7 * 24 * 60 * 60); ???????????????????// 7 days; 24 hours; 60 mins; 60secs echo Now:???????. date(Y-m-d) .\n; echo Next Week: . date(Y-m-d, $nextWeek) .\n; ? 10.1.2 处理时间 函数: int strtotime ( string time [, int now] ) 说明:将任何英文文本的日期时间描述解析为 Unix 时间戳。 ?php echo strtotime(now), \n; echo strtotime(10 September 2000), \n; echo strtotime(+1 day), \n; echo strtotime(+1 week), \n; echo strtotime(+1 week 2 days 4 hours 2 seconds), \n; echo strtotime(next Thursday), \n; echo strtotime(last Monday

文档评论(0)

1亿VIP精品文档

相关文档