我正在使用QR google api創建QR碼,但希望能夠使用PHP下載圖像。我在網上查找,但似乎無法找到有用的東西。有什麼建議麼?如何創建QR碼的下載鏈接?
我創建的QR碼,像這樣:
function generateQR($url, $width = 150, $height = 150) {
$url = urlencode($url);
$image = '<img src="http://chart.apis.google.com/chart?chs='.$width.'x'.$height.'&cht=qr&chl='.$url.'" alt="QR code" width="'.$width.'" height="'.$height.'"/>';
return $image;
}
echo(generateQR('http://google.com'));
file_get_contents oO – dynamic 2012-02-17 19:54:22
可能是相關的:http://stackoverflow.com/questions/900207/return-a-php-page-as-an-image – cspray 2012-02-17 19:57:05
不知道你是什麼意思「下載圖像在PHP中」。不過,你必須用urlencode編碼url。 – satoshi 2012-02-17 19:57:37