这个问题已经在这里有了答案:




9年前关闭。






我有一些JavaScript文本包含“\ u003c”(小于符号
有没有允许我取消javascript的php函数?

(尽管我尝试了urldecode,但我没想到它会起作用。它的确不是。)

最佳答案

是的,只是建议它,urldecode();
尝试:

<?php
  function utf8_urldecode($str) {
    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
    return html_entity_decode($str,null,'UTF-8');;
  }
?>

Reference

关于php - 如何在PHP中取消对Javascript的转义,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6363327/

10-11 12:31
查看更多