The main requirement for this very short code is whether the folder where you save the address has write permission. If so, it can be used. If not, no error will be reported but it cannot be implemented. Without further ado, let’s get straight to the code
There are also several stone-encapsulated functions that can be used to synthesize pictures
http://www.thinkphp.cn/code/edit/id/2349.html
$url = 'Online address, but due to function, it can only support jpg or jpeg';
/**Save the image to the local image path*/
$imgurl = 'Uploads/'.rand(0,99999).'.jpg';
/**write file*/
$qrcodeurl = imagecreatefromjpeg($url);
/**Save and download to local 50 is the image quality*/
imagejpeg($qrcodeurl, $imgurl, 50);