Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有双fwrite的php imagepng_Php_Image_Fwrite - Fatal编程技术网

带有双fwrite的php imagepng

带有双fwrite的php imagepng,php,image,fwrite,Php,Image,Fwrite,此php代码在文件中附加了两行: $t = microtime(); $fn = $DOCUMENT_ROOT."/test.txt"; $f = fopen($fn, "a"); fwrite($f, "\n". $t); fclose($f); header('Content-Type: image/png'); $im = imagecreatetruecolor(1,1); imagepng($im); imagedestroy($im); 通过一次浏览输出到文件的示例: 0.434

此php代码在文件中附加了两行:

$t = microtime();
$fn = $DOCUMENT_ROOT."/test.txt";
$f = fopen($fn, "a");
fwrite($f, "\n". $t);
fclose($f);

header('Content-Type: image/png');
$im = imagecreatetruecolor(1,1);
imagepng($im);
imagedestroy($im);
通过一次浏览输出到文件的示例:
0.43408601412017949
0.46703300142017949

我想代码只是附加一行与一个浏览

(imagejpeg或imagegif比imagepng快?)


请参阅endpoint

new Image().src
,如果在那里使用,将触发重新加载
debug.php
文件,我假定该文件是图像生成器的URL。您正在触发第二次加载的图像,因此有两行。

我在没有javascript的情况下测试了它,只需键入浏览器的url。嗯,Firefox v32重现了这一点,但Chrome v37没有!这是Firefox的错误吗?javascript代码在另一个文件中,例如html5.js,而不是debug.php中
// This is an javascript debug trick:
new Image().src = "http://d_o_m_a_i_n/debug.php?p=msg";