我有 JavaScript
<script type="text/javascript">
var abc = document.createElement('script');
var bhs_id = "yvw3lwc1tnvq670ybzprm8uhuhjrider";
bhs.src = "//example.com/abc.php?site=" + bhs_id + "";
document.head.appendChild(bhs);
</script>
将数据添加到数据库中,我制作了一个简单的php文件,该文件输出与网站id相对应的在线用户,即bhs_id,在上面的脚本中不同网站的id不同。
如上面的脚本将数据插入数据库。此外,我想以与在 whos.amung.us 网站上相同的方式在图像上向在线访问者显示该特定网站
有人可以指导我吗?提前致谢。
最佳答案
它真的需要是图像吗?
您可以创建一段 html,例如:
<div class="counter-wrapper">
<img src="your-counter-image.png">
<span><!-- Print your counter value here --></span>
</div>
并使用 css 对其进行样式设置:
div.counter-wrapper {
position: relative;
}
div.counter-wrapper > span {
position: absolute;
top: 50%; // Adjust this values according to your image.
left: 50%; // The value can be in %, px, cm, rem, etc.
}
关于javascript - 如何在图像上显示 php 变量输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40998273/