随笔
七七七七丶
这个作者很懒,什么都没留下…
展开
-
php微信支付
服务端控制器代码 class PaymentController { private $common = null; public function __construct() { $this->common = new Common(); } private function message($message, $error = '1') { $this->co...原创 2019-10-22 10:17:57 · 173 阅读 · 0 评论 -
curl请求
curl请求 url为请求的地址 params为ppst请求的数据,若为空则是get public function makeRequest($url, $params = array(), $expire = 0, $extend = array(), $hostIp = '') { if (empty($url)) { return array('code' =&...原创 2019-10-22 10:08:10 · 131 阅读 · 0 评论 -
php跳出循环continue,break,exit
continue:跳出当前的循环(一重) public function x() { for ($i=0; $i < 5; $i++) { dump($i); continue; dump($i); } } 输出结果:<pre>int(0) </pre> <pre>int(1) </pre&原创 2018-12-08 10:59:52 · 593 阅读 · 0 评论 -
TP验证码
public function code() { $config = array( 'codeSet' => '0123456789', 'fontSize' => 50, 'length' => 5, //'useCurve' => false, 'useNoise' => false, ); $verify = new \Think\Ve...原创 2018-11-27 11:10:11 · 321 阅读 · 0 评论 -
TP利用水印进行图片合成
public function shopCode($store_user_id,$user_id,$data_send,$savepath,$status,$class_id) { $img_path = ROOT . 'style/kong.png'; $user_shop_model = new \Common\Model\UserShopModel(); $shop_...原创 2018-11-27 10:31:59 · 492 阅读 · 0 评论 -
php更换二维码中间的图片
protected function codeImg($logo ,$QR ,$pathimg) {//$logo要更换的图片路径,$QR二维码图片路径,$pathimg完成后图片存储路径 $dir = $QR; $QR = imagecreatefromstring(file_get_contents($QR)); $logo = imagecreatefromstring(f...原创 2018-11-27 10:30:22 · 697 阅读 · 0 评论 -
修改图片为圆形
function createRoundImg($imgpath,$circle_path) {//$imgpath原图片路径,$circle_path完成后图片存储路径 $ext = pathinfo($imgpath); $src_img = null; switch ($ext['extension']) { case 'jpg': ...原创 2018-11-27 10:28:22 · 468 阅读 · 0 评论 -
php获取小程序二维码
public function getWxcode($store_me, $user_me, $url,$status=1,$type=1){ $ACCESS_TOKEN = $this->getWxAccessToken(); $url_token = "https://api.weixin.qq.com/wxa/getwxacode?access_token="....原创 2018-11-27 10:26:15 · 290 阅读 · 0 评论 -
php 小程序发送模板消息
public function senMsg(){ $ACCESS_TOKEN = $this->getWxAccessToken(); $url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=".$ACCESS_TOKEN['access_token']; ...原创 2018-11-27 10:21:50 · 233 阅读 · 0 评论 -
从一个数组中抽取不同的元素
public function j() { $user = array(1,1,2,1,1,1,1,1,9); $draw_user = []; $num = 3; for ($i=0; $i < $num; $i++) { $user_key = array_rand($user,1); $draw_user[] = $user[$user_key]; $chec...原创 2018-11-27 10:17:04 · 697 阅读 · 0 评论