【问题标题】:Adding html <a> tag in php在php中添加html <a>标签
【发布时间】:2016-03-17 09:28:45
【问题描述】:

有没有办法在 php 脚本中添加 html &lt;a&gt; 代码,如下所示:

<div id="flashDiv" align="center" style="position:absolute; top:20%; left:30%; z-index:51;">
<?php if ($OS == Windows): ?>
<a target="_blank" href="http://localhost/file.exe">
    <img src="http://localhost/flower.png"></img>
</a>
</div>
<?php else: ?>
nothing

【问题讨论】:

  • 是的,但在您的示例中缺少 endif

标签: php html


【解决方案1】:

你需要使用正确的语法:p

<div id="flashDiv" align="center" style="position:absolute; top:20%; left:30%; z-index:51;">
<?php if ($OS == "Windows"): ?>
<a target="_blank" href="http://localhost/file.exe">
    <img src="http://localhost/flower.png">
</a>
</div>
<?php endif; ?>

【讨论】:

  • 没有&lt;/img&gt; 请您更正一下。 :)
猜你喜欢
  • 2019-01-24
  • 1970-01-01
  • 1970-01-01
  • 2012-11-03
  • 2021-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-06
相关资源
最近更新 更多