繁体   English   中英

iFrame 使用 PHP 在 URL 中传递用户名和密码

[英]iFrame Pass username and password inside URL using PHP

我已尝试使用以下代码将 iframe 页面加载到我的视图文件中,但无法获得响应。

<section class="slice color-three pb-4">
   <div class="w-section inverse p-0">
     <div class="card col-md-12 pb-4">
        <iframe id="sms_service" src="https://username:password@abc.com/send_sms?account=123456789" height="450" width="100%"></iframe>                                                     
     </div>
   </div>
</section>

如果我在浏览器中直接运行 URL 然后得到 iframe 页面。

所以我可以使用 iframe URL 传递用户名和密码。

您使用代码使用 htpasswd 加载 iframe 的方式 - 基本身份验证似乎可以纠正它可能是跨域的问题。

你可以检查控制台,看看你是否得到了跨域的错误,那么你需要允许你的坐 url(你添加这个 iframe 的地方)来获取 ifram url 项目或为你的域添加允许跨域到ifram url 脚本,例如“abc.com/send_sms”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM