【发布时间】:2022-02-10 01:01:23
【问题描述】:
我有一个位于服务器上的远程 php 文件
https://webserver.com/file.php
我在另一台服务器上的 html 文件中有几个图像,它们通过链接
<div class="apps">
<a href = "file.php?type=1"><img src="https://anysite.com/image.jpeg" alt="image" border="0"></a></br>
logo
</div>
我想用一个变量替换主链接并将其添加到我的图像中。
应该出现以下链接:
<div class="apps">
<a href = "$variable?type=1"><img src="https://anysite.com/image.jpeg" alt="image" border="0"></a></br>
logo
</div>
图片的最终链接是:
https://webserver.com/file.php?type=1
有人可以帮忙吗?
html代码如下:
<html>
<head> </head>
<?php
var $variable = "https://webserver.com/file.php";
?>
<body>
<div class="apps">
<a href = "$variable?type=1"><img src="https://anysite.com/image.jpeg" alt="image" border="0"></a>
logo
</div>
<div class="apps">
<a href = "$variable?type=2"><img src="https://anysite.com/image2.jpeg" alt="image2" border="0"></a>
logo
</div>
</body>
</html>
【问题讨论】:
-
请写一些你试图解决问题的代码
标签: javascript php html