【问题标题】:How to replace [USER_ID] with the actual uid in a offerwall iframe如何用 offerwall iframe 中的实际 uid 替换 [USER_ID]
【发布时间】:2015-07-04 22:38:54
【问题描述】:

我正在创建一个 GPT 网站 (Get-Paid-to),人们在完成报价后会获得奖励,但我在将 uid 添加到报价墙的链接时遇到了问题 示例:

<iframe src="https://example.com/api/?key=xxxxxx&uid=[USER_ID]" width="500" height="900" frameborder="0"></iframe>

如何将uid=[USER_ID] 替换为uid=12345? 谢谢

【问题讨论】:

  • 你尝试过什么?发布您的 php 代码。
  • 你在哪里设置 javascript 的 scr url,我来自哪里的用户?
  • 我想我正在寻找的是如何在 example.com/[USER_ID] 之类的链接中替换 USER_ID
  • 在下面查看我的答案,一个简单的字符串替换就可以了

标签: javascript php iframe uid


【解决方案1】:

使用 javascript 你可以做到str = str.replace("[USER_ID]", 123); 其中 str 是包含 uid=[USER_ID] 的字符串 所以字符串将是 uid=12345

所以:

 <iframe id="iframeId" width="500" height="900" frameborder="0">
    <script>
        var str = "https://example.com/api/?key=xxxxxx&uid=[USER_ID]", 
            userId = 12345;

        document.getElementById('iframeId').src = str.replace("[USER_ID]", userId);
    </script>

将设置结果

 <iframe id="iframeId" src="https://example.com/api/?key=xxxxxx&uid=12345" width="500" height="900" frameborder="0">

【讨论】:

  • 我正在使用authpro.com,它给了我一个注册页面,它几乎给了用户一个ID 这个脚本有用户的信息,但我希望能够从中提取 uid 添加到具有 uid='[USER_ID]' 的地方
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-29
  • 1970-01-01
  • 2011-03-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多