Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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
超链接连接到php页面中的图像文件_Php_Html_Hyperlink_Tags - Fatal编程技术网

超链接连接到php页面中的图像文件

超链接连接到php页面中的图像文件,php,html,hyperlink,tags,Php,Html,Hyperlink,Tags,我正在写下面的代码 <?php if ($reminderplus>0) { echo '<image source="/filepath/thisimage" width="100" height="50">'.'<center><b> Reminder Center</b></center>' ; } ?> 我想添加到该图像的链接,所以如果用户单击该链接,则会转到另一个页面, 通常

我正在写下面的代码

<?php 

  if ($reminderplus>0)
  {
      echo '<image source="/filepath/thisimage" width="100" height="50">'.'<center><b> Reminder Center</b></center>' ;
  }


?>
我想添加到该图像的链接,所以如果用户单击该链接,则会转到另一个页面, 通常我会添加 有人能帮我告诉我需要放在哪里吗?

试试这个

echo '<a href="path_to_page"><img src="/filepath/thisimage" width="100" height="50">'.'<center><b> Reminder Center</b></center></a>' ;

如果我正确理解了你的问题,你必须把你的链接放在你的图片之前,你也可以在你的中心文本中重复你的链接,如下所示

echo '<a href="page_name.php"><image source="/filepath/thisimage" width="100" height="50"></a>'.'<center><b><a href="page_name.php">Reminder Center</a></b></center>' ;

这非常有效。请检查它。

首先,在有效的HTML中,这应该是:

echo '<image src="/filepath/thisimage" width="100" height="50">'.'<center><b> Reminder Center</b></center>' ;
链接应该是

<a href="thisfile.php"></a>
然后,对于链接,如果您希望它只链接图像,那么将其放在图像代码周围,如下所示

echo '<a href="thisfile.php"><image src="/filepath/thisimage" width="100" height="50"></a>'.'<center><b> Reminder Center</b></center>' ;
否则,如果您希望文本和图像都是链接,只需将其放在它们周围即可

echo '<a href="thisfile.php"><image src="/filepath/thisimage" width="100" height="50"></a>'.'<a href="thisfile.php"><center><b> Reminder Center</b></center></a>' ;
HTML是非常灵活的,因为它并不真正关心你先放什么,只要你以相同的顺序打开和关闭它

echo '<a href="thisfile.php"><image src="/filepath/thisimage" width="100" height="50"></a>'.'<a href="thisfile.php"><center><b> Reminder Center</b></center></a>' ;