海豚框架之生成二维码

生成二维码并返回图片id

function qrcode($text){
    
    $texts='http://baidu.com/register?code='.$text; //这里是要生成的二维码的连接
    $rand = time().rand(10000,99999);
    $url =  'qr/'.$rand.'.png';
    plugin_action('Qrcode/Qrcode/generate', [$texts,$url]);
    
    $row['uid'] = 100; 
    $row['name'] = $rand.'.png';
    $row['module'] = 'user';
    $row['path'] = $url;
    $row['ext'] = 'image/png';
    $row['create_time'] = time();
    $inpicid = Db::name('admin_attachment')->insertGetId($row); //创建一个表 专门来存储图片的(海豚框架中 自带这个表)
    return $inpicid;
}
原文地址:https://www.cnblogs.com/cyk2/p/11951046.html