获取微信带参数二维码 生成海报

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
$user_id = 1;
$token $this->getAccessToken();
 
$url "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" $token;
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_URL, $url);
curl_setopt($ch1, CURLOPT_POST, 1);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, false);
 
//curl_setopt($ch1, CURLOPT_POSTFIELDS, '{"expire_seconds": 604800, "action_name": "QR_STR_SCENE", "action_info": {"scene": {"scene_str": "'.$user_id.'"}}}');
curl_setopt($ch1, CURLOPT_POSTFIELDS, '{"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_str": "'.$user_id.'"}}}');
 
$c = curl_exec($ch1);
$result = @json_decode($c, true);
 
$ticket $result["ticket"];
$qr_path 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='.$ticket;
 
$bigImgPath "xxxxxxxxxxx.png";
 
$bigImg = imagecreatefromstring(file_get_contents($bigImgPath));
$qCodeImg = imagecreatefromstring(file_get_contents($qr_path));
  
$save_width = 200; 
$save_height = 200;
list($qCodeWidth$qCodeHight$qCodeType) = getimagesize($qr_path);
$new_image = imagecreatetruecolor($save_width$save_height);
$s = imagecopyresampled($new_image$qCodeImg, 0, 0, 0, 0, $save_width$save_height$qCodeWidth$qCodeHight);
 
imagecopymerge($bigImg$new_image, 265, 370 , 0, 0, $save_width$save_height, 100);
 
$img_path = time().rand(100000,999999).'.jpg';
imagejpeg($bigImg,'xxxxxxx/images/'.$img_path);
 
include $this->template('code');

JAVA 子类调用父类方法时,方法中的变量用谁的?

1
2
3
4
5
6
7
public class T1 {
    private int a=6;
  
    public void ha(){
        System.out.println(this.a);
    }
}
1
2
3
public class T2 extends T1{
        int a=7;
}
1
2
3
4
5
public class Test {
    public static void main(String[] args) {
        new T2().ha();
    }
}

输出结果为6

结论:子类调用父类方法时,方法中的变量用父类的

这个结果是很有意思的,我之前以为既然是子类调用父类的方法 那么应该是子类自动继承了父类 然后在自己类的内部使用自己的变量

没想到会使用父类内定义的变量值