-
TP的whereOr查询加括号和闭包传值
加一个闭包就可以了,但是闭包不能传值,使用use传值给闭包就可以使用了
-
TP数组转josn字符串保存数据库编码处理
处理前:处理后:
-
PHP 时间计算(距离现在多长时间)
functionformat_date($time){ $t=time()-$time; $f=array( '31536000'=>'年', '2592000'=>'....
-
tp5时间戳扩展获取本周开始和结束(week)bug解决
$timestamp=time();$startTime=strtotime(date('Y-m-d',strtotime('+0weekMonday',$timestamp)));$endTime=....
-
PHP查询本周数据,本周开始时间戳,结束时间戳
$arr=array();$arr=getdate();$num=$arr['wday'];$start=time()-($num-1)*24*60*60;$end=time()+(7-$num)*2....
-
php中查找数组中是否存在某个元素
查找一个元素是否在数组中,一共有上面三种做法:in_array'函数在数组中搜索给定的值。in_array(value,array,type)type可选。如果设置该参数为true,则检查搜索的数据与....
-
RSA加密解密(PHP Demo)
演示代码:publicfunctionmds($val='加密值'){$fp_private=fopen('key/rsa_private_key.pem','r');//私钥$private_key....
-
thinkphp5 think\response\json Object 转数组
$result为json对象数据集可使用getContent()方法输出数组格式:print_r(json_decode($result->getContent(),true));
-
PHP重建数组的键值索引
sort()array_merge()跟一个空数组合并都可以重建索引数组的键值
-
PHP传入特殊字符输出处理
//前端出入:WkjxO9EYhuKNm6inR8HghuYJeffVZJVCWchM6dovk\/y5YHohyrExniMihFRGm+aLufqZ.//输出的话加号不能输出,使用URLencod....