I can't get this script to save an image to a folder... The error is:
Warning: fopen(/var/www/tmp/image2.png): failed to open s开发者_开发问答tream: Permission denied in /var/www/testqr.php on line 15
Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/testqr.php on line 16
Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/testqr.php on line 17
<?php
$fl = $_SERVER['DOCUMENT_ROOT'].'/tmp/image2.png';
$file = fopen($fl, "w");
$url = "http://chart.apis.google.com/chart?chs=150x150&cht=qr&chld=L|0&chl=http://superiorwebsys.com'";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FILE, $file);
curl_exec($curl);
curl_close($curl);
fclose($file);
?>
do this:
chown -R your_username /your/directory/
chmod -R 777 /your/directory/
精彩评论