php
Super_boy_son
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
2021-08-06
json_decode(trim($param, chr(239) . chr(187) . chr(191))); 上方代码的作用。接口传回了json字符串数据,但是用json_decode()转码的时候发现,数据为NULL。原因就是UTF-8的BOM头的影响.BOM是什么 Unicode的学名是"Universal Multiple-Octet Coded Character Set",简称为UCS。UCS可以看作是"Unicode Character Set"的缩写。在UCS 编...原创 2021-08-06 15:10:58 · 164 阅读 · 0 评论 -
PHP下载远程图片并保存到本地
方式1:/*** 远程下载图片* @param $url* @param string $save_dir* @param string $filename* @param int type∗@returnarray∗/publicstaticfunctiongetImage(type * @return array */ public static fun...转载 2019-10-16 13:44:40 · 260 阅读 · 0 评论 -
PHP中的精确计算bcadd,bcsub,bcmul,bcdiv
<?php/精确加法@param [type] $a [description]@param [type] b[description]∗/functionmathadd(b [description]*/function math_add(b[description]∗/functionmathadd(a,b,b,b,scale = ‘2’) {return bcadd(...转载 2019-10-14 17:32:15 · 1629 阅读 · 0 评论 -
php 数组分页
/** * 数组分页函数 核心函数 array_slice * 用此函数之前要先将数据库里面的所有数据按一定的顺序查询出来存入数组中 * count每页多少条数据∗count每页多少条数据∗count 每页多少条数据 * page 当前第几页 * array查询出来的所有数组∗order0−不变1−反序∗array查询出来的...原创 2018-08-29 13:32:37 · 273 阅读 · 0 评论 -
移动端表情处理
移动表情处理:正则匹配 base64进行处理 入库前: $text = preg_replace_callback('/[\xf0-\xf7].{3}/', function($r) { return '@E' . base64_encode($r[0]);}, $data['content']); 库中取出: preg_replace_call...原创 2018-05-18 11:45:29 · 633 阅读 · 0 评论 -
二维数组根据字段进行排序
/** * 二维数组根据字段进行排序 * @params array $array 需要排序的数组 * @params string $field 排序的字段 * @params string $sort 排序顺序标志 SORT_DESC 降序;SORT_ASC 升序 */ public function arraySequen原创 2018-03-28 15:15:25 · 273 阅读 · 0 评论 -
计算时间相差年、月、天、时、分、秒
/** * function:计算两个日期相隔多少年,多少月,多少天 * param string $date1[格式如:2011-11-5] * param string $date2[格式如:2012-12-01] * return array array('年','月','日'); */function diffDate($date1,$date2){转载 2018-01-29 13:13:29 · 724 阅读 · 0 评论 -
php 获取当月开始的第一天并且到当月结束23:59:59
start=mktime(0,0,0,date(‘m′),1,date(‘Y′));" role="presentation" style="position: relative;">start=mktime(0,0,0,date(‘m′),1,date(‘Y′));start=mktime(0,0,0,date(‘m′),1,date(‘Y原创 2018-02-01 13:40:58 · 507 阅读 · 0 评论 -
周一到周日,和 每月开始到结束
//获取日期,每周一到每周日public static function day_week(){for ($i=0; $i $arr[$i]= time()-((date('w')==0?7:date('w'))-$i)*24*3600;}$new=array();foreach($arr as $k=>$v){ $new[$k]['start']=m原创 2018-01-24 16:18:44 · 278 阅读 · 0 评论 -
时间计算,几天前、几分钟前、几秒前、
//计算时间差 public function time_tran($time) { $t=time()-$time; $f=array( '31536000'=>'年', '2592000'=>'月', //'604800'=>'星期',转载 2018-01-03 16:10:58 · 2159 阅读 · 0 评论 -
时间戳获取
$sql = "select count(*) from snake_xcx_order where agent_id = 16 and create_time between UNIX_TIMESTAMP(CAST(SYSDATE()AS DATE)) and UNIX_TIMESTAMP(CAST(SYSDATE()AS DATE) + INTERVAL 1 DAY)";http://转载 2018-01-14 17:11:06 · 322 阅读 · 0 评论 -
mongo
$m = new \MongoClient('mongodb://IP地址:27017');$collection = $m->map->machine;$document = [ 'machine_no' => 123321 // 机器编号 "address" => '北京市朝阳区***大厦2楼',//详细地址 'type'=>1,/转载 2018-01-14 11:52:29 · 168 阅读 · 0 评论
分享