随笔分类 - php
摘要:$str = '姓名:{username},年龄:{age}'; preg_match_all("/[{](.*?)[}]/", $str, $res);//加?,使用非贪婪模式 return $this->success($res); { "status": "true", "code": 200
阅读全文
摘要:bc函数库 https://www.php.net/manual/zh/ref.bc.php
阅读全文
摘要:public function index() { $data = [ [ 'id' => 1, 'b' => '11', 'c' => '11', ], [ 'id' => 2, 'a' => '33', 'b' => '33', ], [ 'id' => 3, 'a' => '22', 'b'
阅读全文
摘要://导出excel public function dataToExcel($filename, $data, $header, $keys) { $html = $this->dataToHtml($data, $header, $keys); return $this->htmlToExcel(
阅读全文
摘要://获取某个日期所在月的第n周的时间范围(第一周 1号至7号) function getOneWeekByDate($date = '', $n = 5) { $date = strtotime('20211001'); $t = date('t', $date); //当月天数 $n_max =
阅读全文
摘要://获取指定日期所在月的各个周的时间范围 第一周 1号至7号 以此类推 function getWeekByDate($date) { $date = strtotime($date); //月初日期 $start_time = mktime(0, 0, 0, date('m', $date), '
阅读全文
摘要:我们可以从上传视频中截取固定时间点的帧,以作为这些视频的封面图片。视频截图如下所示: http://<your_uploaded_video>?vframe/jpg/offset/5
阅读全文
摘要:<script language="JavaScript"> if (window != top) top.location.href = location.href; </script>
阅读全文
摘要:function fileShow($dir){ $handle = opendir($dir); // 打开目录句柄 while ($file = readdir($handle)) { // 返回目录句柄中的条目 if ($file !== '..' && $file !== '.') { $f
阅读全文
摘要:$phar = new PharData('leixuesong.tar.gz'); //解压后的路径 数组或者字符串指定解压解压的文件,null为全部解压 是否覆盖 $phar->extractTo('./tmp', null, true);
阅读全文
摘要:public function index() { $str = '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
阅读全文
摘要://gps转wgs $a=12012.452136 public static function gps2Wgs($a) { return floor($a / 100) + fmod($a, 100) / 60; }
阅读全文
摘要:$url='www.test.com?name=a&age=1'; $res=parse_url($url); parse_str($res['query'],$res);var_dump($res); { "status": 200, "message": "操作成功", "result": {
阅读全文
摘要:public function index() { if(Request::isPost()){ if(password_verify('123456','$2y$10$1/UPLaqLTJ3RNjTCfgb6.ewfbRDSyINdNOan8uI/WOuMymbY5cNbm')){ return
阅读全文
摘要:public function is_point_in_polygon($point, $pts) { $N = count($pts); $boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true $intersectCount = 0;/
阅读全文
摘要:if(! function_exists('bdEncrypt')) { //GCJ-02(火星,高德)坐标转换成BD-09(百度)坐标 //@param $longitude 高德经度 //@param $latitude 高德纬度 function bdEncrypt($longitude,$l
阅读全文
摘要:public function curlrequest($url,$data,$method = 'GET',$type='json',$headers=[]) { try{ //初始化 $ch = curl_init(); $headers[] = "cache-control: no-cache
阅读全文
摘要:<iframe src="http://i.tianqi.com/index.php?c=code&id=7" ></iframe>
阅读全文
摘要:$.ajax({ url:"{:url('user')}", data:{"group_id":data.value}, type:'post', dataType:'json', success:function (res) { console.log(res); for(var i=0;i<re
阅读全文

浙公网安备 33010602011771号