将链接转换为图像

时间:2013-07-17 07:03:56

标签: php html css

简单的问题。

如何使此链接成为图像?

示例:

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

更新&lt; - 应该是带有标题的图片。

4 个答案:

答案 0 :(得分:2)

替换

<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']包含的内容,您可能需要查看转义和urlencoding以防止XSS

示例:

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

答案 1 :(得分:2)

您要链接图片吗?

WITH TITLE:

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

答案 2 :(得分:0)

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

答案 3 :(得分:0)

尝试

<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;

}
相关问题