我基本上正在尝试使用Google的QR Code API从字节数组创建QR码。我试着将'chl'变量(QR码的数据)传递给Google的web后端一个字节数组,但它似乎从不喜欢它。我已经使用Google的PHP示例作为我的代码的基础,但如果有人知道使用Google的API将字节数组简单地转换为QR码的替代方法,那么这是唯一的目标。小文件到QR码
<?php
// Create some random text-encoded data for a QR code.
//header('content-type: image/png');
$url = 'https://chart.googleapis.com/chart?chid=' . md5(uniqid(rand(), true));
$chd = file($_FILES["file"]["tmp_name"]);
// Add image type, image size, and data to params.
$qrcode = array(
'cht' => 'qr',
'chs' => '300x300',
'choe' => 'ISO-8859-1',
'chl' => $chd);
// Send the request, and print out the returned bytes.
$context = stream_context_create(
array('http' => array(
'method' => 'POST',
'content' => http_build_query($qrcode))));
fpassthru(fopen($url, 'r', false, $context));
?>
有PHP,处理上传的文件并通过字节数组发送到谷歌的API。
请向我们展示您尝试过的代码。 – richsage
您可以尝试将数据转换为十六进制。 – Blender
添加了一些PHP尝试从上传的文件发送字节数组。 – VashGH