2020年4月9日
<?phpdate_default_timezone_set('PRC');$the_start= microtime(true);echo"<pre>";var_dump(time());$res=date('D');$res=date('d');$res=date('Y/m/d H:i:s');var_dump($res);echo"<hr>";$a=getdate();var_dump($a);echo"<hr>";echo strtotime("now"),"<br>";echo strtotime("6 March 2000"),"<br>";echo strtotime("+1 days"),"<br>";echo strtotime("+1 week"),"<br>";echo strtotime("next Friday"),"<br>";echo"2018/3/10 09:15:00";echo strtotime("2018/3/10 09:15:00");echo"<hr>";$res= microtime();var_dump($res);$res=microtime(true);var_dump($res);sleep(20);$the_end = microtime(true);var_dump($the_start);var_dump($the_end);echo"本页面运行时间:", $end_time - $start_time ,'s';echo"</pre>";<?php$post=$_POST;var_dump($post);$a="/\[(\d{1,3})]";preg_match_all($a,$post['a'],$arr);var_dump($arr);$b='<img src="\\1.png">';$c=preg_replace($a,$b,$_POST['a']);?><!DOCTYPE html><html><head><title>表情</title><meta charset="utf-8"></head><body><form action="" method ="post"><textarea name="ac" id="" cols ="40" rows="20"></textarea><button>发送</button></form></body></html>php2<?phpdate_default_timezone_set('PRC');$the_start= microtime(true);echo"<pre>";var_dump(time());$res=date('D');$res=date('d');$res=date('Y/m/d H:i:s');var_dump($res);echo"<hr>";$a=getdate();var_dump($a);echo"<hr>";echo strtotime("now"),"<br>";echo strtotime("6 March 2000"),"<br>";echo strtotime("+1 days"),"<br>";echo strtotime("+1 week"),"<br>";echo strtotime("next Friday"),"<br>";echo"2018/3/10 09:15:00";echo strtotime("2018/3/10 09:15:00");echo"<hr>";$res= microtime();var_dump($res);$res=microtime(true);var_dump($res);sleep(20);$the_end = microtime(true);var_dump($the_start);var_dump($the_end);echo"本页面运行时间:", $end_time - $start_time ,'s';echo"</pre>";<?php$post=$_POST;var_dump($post);$a="/\[(\d{1,3})]";preg_match_all($a,$post['a'],$arr);var_dump($arr);$b='<img src="\\1.png">';$c=preg_replace($a,$b,$_POST['a']);?><!DOCTYPE html><html><head><title>表情</title><meta charset="utf-8"></head><body><form action="" method ="post"><textarea name="ac" id="" cols ="40" rows="20"></textarea><button>发送</button></form></body></html>php3<?phpdate_default_timezone_set('PRC');$the_start= microtime(true);echo"<pre>";var_dump(time());$res=date('D');$res=date('d');$res=date('Y/m/d H:i:s');var_dump($res);echo"<hr>";$a=getdate();var_dump($a);echo"<hr>";echo strtotime("now"),"<br>";echo strtotime("6 March 2000"),"<br>";echo strtotime("+1 days"),"<br>";echo strtotime("+1 week"),"<br>";echo strtotime("next Friday"),"<br>";echo"2018/3/10 09:15:00";echo strtotime("2018/3/10 09:15:00");echo"<hr>";$res= microtime();var_dump($res);$res=microtime(true);var_dump($res);sleep(20);$the_end = microtime(true);var_dump($the_start);var_dump($the_end);echo"本页面运行时间:", $end_time - $start_time ,'s';echo"</pre>";<?php$post=$_POST;var_dump($post);$a="/\[(\d{1,3})]";preg_match_all($a,$post['a'],$arr);var_dump($arr);$b='<img src="\\1.png">';$c=preg_replace($a,$b,$_POST['a']);?><!DOCTYPE html><html><head><title>表情</title><meta charset="utf-8"></head><body><form action="" method ="post"><textarea name="ac" id="" cols ="40" rows="20"></textarea><button>发送</button></form></body></html>
笔记:
模拟微信发表情
表单内输入发送文字
=>点击发送
=>数据提交php
=>php接收数据
=>解析【名字】表情;在网页中图片用img标签;【名字】转换为对应的img标签;
=>img标签连同文字输出到网页上
时间函数:
prc中国时间
utc时间标准时间
函数设置时区:date_default_timezone_set(‘prc’);
time() 获取当前时间的时间戳(1970/1/1 00:00:00 到现在的秒数)
date() 格式化一个本地时间/日期
date_default_timezone_set 设置时区
getdate() 取得日期或时间信息
strtotime() 将任何英文文本的日期时间描述解析为时间戳 +1 day +1 week
mictotime() 返回当前的时间戳和微秒数
getdate([时间戳 = time()])
array(
[0] => seconds 秒
[1] => minutes 分
[2] => hours 时
[3] => mday 本月第几天
[4] => wday 本周第几天
[5] => mon 月份(数字)
[6] => year 年
[7] => yday 今年第几天
[8] => weekday 周几(英文)
[9] => month 月
[10] => 0 时间戳
)
