分享php過濾XSS攻擊的函數

來源:文萃谷 1.57W

php過濾XSS攻擊的函數是什麼呢?以下是小編分享php過濾XSS攻擊的函數,就跟隨本站小編一起去了解下吧,想了解更多相關信息請持續關注我們應屆畢業生考試網!

分享php過濾XSS攻擊的函數

以下函數:

過濾用户的`輸入,保證輸入是XSS安全的。

例子:

複製代碼 代碼示例:

<?php

/**

* 過濾XSS攻擊

* edit:

*/

function RemoveXSS($val) {

// remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed

// this prevents some character re-spacing such as <java