Base64/二维码图片地址解析成字符串地址

// 引入类库
include_once('./lib/QrReader.php');
// base64位字符串
$base64_string = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAIAAACy8ng9AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAD1UlEQVR4nO3dwW4kJxRA0XGU//9lZ5fFVC+4CChaOmc5GrtrkivkJzD18/v7+weG/fP2A/BlFEOjGBrF0CiG5t/nH/38/Jx/jv89Z7eR51k18T0/a+R55p75adX3WeXjf1VrDI1iaBRDoxgaxdB8mJWe9u09nZyD5j59zsgzr5qnVhl8HmsMjWJoFEOjGBrF0AzNSk8nf84f2ccZ+aoRJ/enVjn8L7XG0CiGRjE0iqFRDM3krPSuuUlk1aQ29zwnp6etrDE0iqFRDI1iaBRD85Wz0tPc3sqqM3gn98teZ42hUQyNYmgUQ6MYmslZ6eRP9av2aPbd23DhDQz7WGNoFEOjGBrF0CiGZmhWencWuP+E28m78t79f/HHGkOlGBrF0CiGRjE0P19x7usv99/svWqf60LWGBrF0CiGRjE0iqHZ+H6lk+fi5j59xG1vbhr5ziOmP90aQ6MYGsXQKIZGMTRH73ZYtZOy6vu8e4/3qr/ztHV/yhpDoxgaxdAohkYxNB/O4L37bqB3z6GdnObm3sN78qs+ssbQKIZGMTSKoVEMzYd9pdt+92fkq55evwNhiZO/CeUMHlsohkYxNIqhUQzNxn2ld6end3fHRty2YzXIGkOjGBrF0CiGRjE0R+8MX7UftO/+7ZNn3kbsu9diep6yxtAohkYxNIqhUQzN5J3h704QI5/19O5N4/vse0KzEgsohkYxNIqhUQzN5Bm8kzdgX3i/wSYnn3D6jKI1hkYxNIqhUQyNYmgm7ww/eRJs3/m6OSf3ni6c+KwxNIqhUQyNYmgUQ7PxDN7Tu3e43XZHxLt33D3ZV2ILxdAohkYxNIqh2XgGb+jjt/3kP2LfZ902Tz25B49DFEOjGBrF0CiGZuj9SiNOzhT332E+4uRNFws/yxpDoxgaxdAohkYxNENn8PadXvvG+/SebvtXjLCvxCGKoVEMjWJoFEMz+ftKJ93/btyT5w9Hvs8q7gxnAcXQKIZGMTSKoflwBu+2/Y6Tb0HaNzm+e5vfwonPGkOjGBrF0CiGRjE0Q3eG3zZBjNj3zPumlX2fNWJwerLG0CiGRjE0iqFRDM3k+5Vu27UZse8du0+3naZbePO5NYZGMTSKoVEMjWJoJmelk/a9r3bu0/ft2qya1Lae97PG0CiGRjE0iqFRDM0XzEojbntL1EmHd+usMTSKoVEMjWJoFEMzOSvddnveu+9O2jdhLTw7t+o7W2NoFEOjGBrF0CiGZmhWenffZMTcW6L23Zzw7sy1dZK1xtAohkYxNIqhUQzNF7xfiatYY2gUQ6MYGsXQKIZGMTT/AfwAEZHvURBNAAAAAElFTkSuQmCC";
$base64_string= explode(',', $base64_string);
$data= base64_decode($base64_string[1]);
// base64保存临时图片,要转地址的图片
file_put_contents('./qr3.png', $data); //写入文件并保存
$qrcode = new QrReader('./qr3.png');  //图片路径
$text = $qrcode->text(); //返回识别后的文本
echo $text;

类库下载地址

你可能感兴趣的:(Base64/二维码图片地址解析成字符串地址)