比如有个变量值是这样的
$a = "<script>window.location.href='http://xxx.com';</script>";在网页上是直接显示但不执行js:
<script>window.location.href='http://xxx.com';</script>查看html源文件是这样:
<script>window.location.href='http://xxx.com';</script>php有这种函数?还是要怎么转换?
$a = "<script>window.location.href='http://xxx.com';</script>";在网页上是直接显示但不执行js:
<script>window.location.href='http://xxx.com';</script>查看html源文件是这样:
<script>window.location.href='http://xxx.com';</script>php有这种函数?还是要怎么转换?
$a = "<script>window.location.href='http://xxx.com';</script>";
$b = htmlspecialchars($a);
echo $b;
//result: <script>window.location.href='http://xxx.com';</script>
//source: <script>window.location.href='http://xxx.com';</script>