005 - 使用script标签解决跨域

xiaoxiao2021-02-28  116

解决跨域问题:

使用script标签向另一个域上的资源进行请求,传递参数fn,保存将来要执行的js函数名

<script> function callback(msg){ alert(msg) } </script> <script src="http://www.b.com?fn=callback"></script> <?php $str = 'Hello zhangSan'; $fn = $_GET['fn']; echo $fn.'("' .$str '")'; ..

转载请注明原文地址: https://www.6miu.com/read-31956.html

最新回复(0)