php关于时间的获取,收藏备用<?php echo "今天:".date("Y-m-d")."<br>"; echo "昨天:".date("Y-m-d",strtotime("-1 day")), "<br>"; echo "明天:".date("Y-m-d",strtotime("+1 day")). "<br>"; echo "一周后:".date("Y-m-d",strtotime("+1 week")). "<br>"; echo "一周零两天四小时两秒后:".date("Y-m-d G:H:s",strtotime("+1 week 2 day

后端 2019-01-05

使用php内置函数 mb_strpos 查找字符位置使用php内置函数 mb_strlen 获取字符串的长度<?php function cut_side($begin,$end,$str){ $b = mb_strpos($str,$begin) + mb_strlen($begin); $e = mb_strpos($str,$end) - $b; return mb_substr($str,$b,$e); }

后端 2018-12-24

data()函数中 w参数表示星期中的第几天,数字表示,0(表示星期天)到 6(表示星期六)<?php $weekarray=array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); echo($weekarray[date("w")]);

后端 2018-12-24

思路:将图片base64值转换生成图片文件并保存,将图片保存路径转换成二维码。二维码的生成使用了phpqrcode类增加了一个删除的操作,传入开始和结束日期,删除该范围内生成的图片及二维码<?php //包含一个文件上传类中的上传类 header('Content-Type: text/html; charset=utf-8'); $content = file_get_contents("php://input"); $content = json_decode($content,true); $type = $content['type']; $errcode = 0; $errtext = ""; $myJson = array(); $savepath = 'static/upload/'; //保存base64图片目录 $qrpath = 'static/qrcode/

后端 2018-08-14

接收前端发送的文本,使用php内置函数实现文本转换图片<?php header('Content-Type: text/html; charset=utf-8'); $content = file_get_contents("php://input"); $content = json_decode($content,true); $type = $content['type']; $errcode = 0; $errtext = ""; $myJson = array(); $greetingpath = 'static/greeting/';//合成图片目录 $jsonfile = 'config.json';//语言合成config文件 $fontttf = "./static/dist/fonts/xiekai.ttf"; //文本字体

后端 2018-08-14