imgsrc中的php页面
我正在尝试创建一个html页面,它使用php页面来决定在设定的时间显示什么图像 唯一的问题是,当我转到php页面时,它将显示正确的图像,但是当我尝试img src php页面时,它在HTML页面上提供了一个死链接。下面是我在HTML和PHP页面上使用的代码 HTML:imgsrc中的php页面,php,image,Php,Image,我正在尝试创建一个html页面,它使用php页面来决定在设定的时间显示什么图像 唯一的问题是,当我转到php页面时,它将显示正确的图像,但是当我尝试img src php页面时,它在HTML页面上提供了一个死链接。下面是我在HTML和PHP页面上使用的代码 HTML: 但是当我把它添加到中时,我得到了一个死链接,php页面或HTML页面上都没有显示图像。如果您有任何帮助,我们将不胜感激。请使用以下选项,而不是使用图像标签: header("Content-Type: image/png"); r
但是当我把它添加到中时,我得到了一个死链接,php页面或HTML页面上都没有显示图像。如果您有任何帮助,我们将不胜感激。请使用以下选项,而不是使用图像标签:
header("Content-Type: image/png");
readfile($img);
使用图像标记时,源必须是图像数据,而不是另一个图像标记。使用以下选项,而不是使用图像标记:
header("Content-Type: image/png");
readfile($img);
使用图像标记时,源必须是图像数据,而不是另一个图像标记。图像不是这样工作的。您需要输出图像的数据,而不是另一个HTML片段
<?php
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: January 01, 2013'); // Date in the past
header('Pragma: no-cache');
header('Content-Type: image/png');
$h = date('Hi');
if ($h >= 2100 && $h < 2230){ $img = '40px-Dni5.png'; }
elseif ($h >= 2230 && $h < 0000){ $img = '40px-Dni3.png'; }
elseif ($h >= 0000 && $h < 0130){ $img = '40px-Dni7.png'; }
elseif ($h >= 0130 && $h < 0137){ $img = '40px-Dni6.png'; }
# HEY! ^ LOOK OVER HERE! ... too many $ signs.
elseif ($h >= 0137 && $h < 0138){ $img = '40px-Dnisolve.png'; }
elseif ($h >= 0138 && $h < 0300){ $img = '40px-Dni6.png'; }
elseif ($h >= 0300 && $h < 0430){ $img = '40px-Dni4.png'; }
elseif ($h >= 0430 && $h < 0600){ $img = '40px-Dni5.png'; }
else{ $img = 'where.png'; }
readfile($img);
?>
图像不是这样工作的。您需要输出图像的数据,而不是另一个HTML片段
<?php
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: January 01, 2013'); // Date in the past
header('Pragma: no-cache');
header('Content-Type: image/png');
$h = date('Hi');
if ($h >= 2100 && $h < 2230){ $img = '40px-Dni5.png'; }
elseif ($h >= 2230 && $h < 0000){ $img = '40px-Dni3.png'; }
elseif ($h >= 0000 && $h < 0130){ $img = '40px-Dni7.png'; }
elseif ($h >= 0130 && $h < 0137){ $img = '40px-Dni6.png'; }
# HEY! ^ LOOK OVER HERE! ... too many $ signs.
elseif ($h >= 0137 && $h < 0138){ $img = '40px-Dnisolve.png'; }
elseif ($h >= 0138 && $h < 0300){ $img = '40px-Dni6.png'; }
elseif ($h >= 0300 && $h < 0430){ $img = '40px-Dni4.png'; }
elseif ($h >= 0430 && $h < 0600){ $img = '40px-Dni5.png'; }
else{ $img = 'where.png'; }
readfile($img);
?>
和。。。上次我查的时候,过去的那个日期不是过去的。而且。。。上次我查的时候,过去的那个日期不是过去的。
<?php
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: January 01, 2013'); // Date in the past
header('Pragma: no-cache');
header('Content-Type: image/png');
$h = date('Hi');
if ($h >= 2100 && $h < 2230){ $img = '40px-Dni5.png'; }
elseif ($h >= 2230 && $h < 0000){ $img = '40px-Dni3.png'; }
elseif ($h >= 0000 && $h < 0130){ $img = '40px-Dni7.png'; }
elseif ($h >= 0130 && $h < 0137){ $img = '40px-Dni6.png'; }
# HEY! ^ LOOK OVER HERE! ... too many $ signs.
elseif ($h >= 0137 && $h < 0138){ $img = '40px-Dnisolve.png'; }
elseif ($h >= 0138 && $h < 0300){ $img = '40px-Dni6.png'; }
elseif ($h >= 0300 && $h < 0430){ $img = '40px-Dni4.png'; }
elseif ($h >= 0430 && $h < 0600){ $img = '40px-Dni5.png'; }
else{ $img = 'where.png'; }
readfile($img);
?>