php微信支付 服务端控制器代码class PaymentController { private $common = null; public function __construct() { $this->common = new Common(); } private function message($message, $error = '1') { $this->co...
curl请求 curl请求url为请求的地址params为ppst请求的数据,若为空则是get public function makeRequest($url, $params = array(), $expire = 0, $extend = array(), $hostIp = '') { if (empty($url)) { return array('code' =&...
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&
TP验证码 public function code() { $config = array( 'codeSet' => '0123456789', 'fontSize' => 50, 'length' => 5, //'useCurve' => false, 'useNoise' => false, ); $verify = new \Think\Ve...
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_...
php更换二维码中间的图片 protected function codeImg($logo ,$QR ,$pathimg) {//$logo要更换的图片路径,$QR二维码图片路径,$pathimg完成后图片存储路径 $dir = $QR; $QR = imagecreatefromstring(file_get_contents($QR)); $logo = imagecreatefromstring(f...
修改图片为圆形 function createRoundImg($imgpath,$circle_path) {//$imgpath原图片路径,$circle_path完成后图片存储路径 $ext = pathinfo($imgpath); $src_img = null; switch ($ext['extension']) { case 'jpg': ...
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="....
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']; ...
从一个数组中抽取不同的元素 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...