将链接转换为图像


convert link into image

简单问题。

如何使这个链接成为图像?

示例:

<a href="updatecompany.php?companycode=<?php echo $r['code']; ?>"> Update </a>

更新<-它应该是一个有标题的图像。

是否要链接图像?

标题:

<a href="updatecompany.php?companycode=<?php echo $r['code']; ?>">
 <img src="path/to/image" title="MY TITLE" alt="MY ALT"/>
</a>

更换

<a href="updatecompany.php?companycode=<?php echo $r['code']; ?>"> Update </a>

<a href="updatecompany.php?companycode=<?php echo $r['code']; ?>"> 
    <img src="/path/to/image.png" alt="Update" title="Update" /> 
</a>

此外,根据$r['code']包含的内容,您可能需要研究转义和url编码以防止XSS。

示例:

<a href="updatecompany.php?companycode=<?php echo urlencode(htmlspecialchars($r['code'])); ?>"> 
    <img src="/path/to/image.png" alt="Update" title="Update" /> 
</a>

尝试

<a href=updatecompany.php?companycode=<?php echo $r['code']; ?>" class="login" title="Login"><img src="../img/user.png"> />Update</a>

.login {
  background: url(../img/user.png) no-repeat 6px center;
  width: 50px;
  height: 50px;
}
<a href="updatecompany.php?companycode=<?php echo $r['code']; ?>">
   <img src="your image path" alt=" your alt text" title="your title text" />
</a>