随笔分类 - php
摘要:项目中经常需要公布一些用户的信息,比如抽奖结果展示,排行榜等。但是很多涉及到用户隐私,比如昵称,姓名,手机号等,这时候就要对用户敏感信息做处理,最常见的就是对手机号加星号处理。方法也非常简单,简单到我再写这篇之前都在考虑要不要发出来。不过还是简单分享一下,如果有兄弟用得上至少可以节省一点时间。 /*
阅读全文
摘要://获取微信access_token public function access_token(){ $appid ='***********'; $secret = '******************'; $url = "https://api.weixin.qq.com/cgi-bin/to
阅读全文
摘要:$url = "https://api.weixin.qq.com/cgi-bin;//file_get_contents发送get请求 json_decode转换数据 $data = json_decode(file_get_contents($url,true),true);
阅读全文
摘要:/** * 发送post请求 * @param string $url 请求地址 * @param array $post_data post键值对数据 * @return string */ function send_post( $url , $post_data ) { $postdata =
阅读全文
摘要:html <div class="zsjm_one_one_one"> <span class="zsjm_one_one_one_span">所在地区: </span> <div class="zsjm_one_one_one_one"> <select id="pro" class="lv_si
阅读全文
摘要:1、php 截取特定字符后面的内容 可以使用函数strripos,获取一个字符串在另一个字符串中第一次出现的位置。 $number = '1_0';$result = substr($number,strripos($number,"_")+1);echo $result; 结果输出 0 2、php
阅读全文
摘要:public function yzm(){ // 创建验证码 $w = 120; $h = 50; // 1.创建画布 $im = imagecreatetruecolor($w, $h); // 2.绘制颜色 $white = imagecolorallocate($im, 255, 255,
阅读全文
摘要:function inquireID1($cate_id){//返回数据会一直叠加 static $arrr= [];//静态变量 $sql = "select id,cate_name,pid from category where pid=$cate_id"; $rows = getAll($s
阅读全文
摘要:function inquireID($list,$cate_id,$filed="*"){ static $arr= [];//静态变量 $sql = "select $filed from $list where id=$cate_id"; $row = getOne($sql); if ($r
阅读全文
摘要:function getTree($data) {//数组 $items = []; foreach ($data as $v){ $items[$v['id']] = $v; // $items[1] = } $tree = array(); //格式化好的树 foreach ($items as
阅读全文