ホームページ  >  記事  >  バックエンド開発  >  PHP 通常フィルター HTML 特殊文字

PHP 通常フィルター HTML 特殊文字

WBOY
WBOYオリジナル
2016-07-25 08:54:051191ブラウズ
  1. $str=preg_replace("/s+/", " ", $str); //余分なキャリッジをフィルタリング$str=preg_replace("/<[ ]+/si", "<",$str); //<__("<" の後ろにスペースを入れます) $str=preg_replace("//si","", $ str); //コメント $str=preg_replace("/<(!.*?)>/si","",$str); //フィルタ DOCTYPE $str=preg_replace("/<(/ ? html.*?)>/si","",$str); //html タグをフィルター$str=preg_replace("//si","", $ str); //br タグをフィルタリング $str=preg_replace("/<(/?head.*?)>/si","",$str); //head タグをフィルタリングする $str=preg_replace ("/ <(/?meta.*?)>/si","",$str); //メタタグをフィルタリング $str=preg_replace("/<(/?body.*?)> /si" ,"",$str); //ボディタグをフィルタリング $str=preg_replace("/<(/?link.*?)>/si","",$str); //フィルタリングリンクタグ $str =preg_replace("/<(/?form.*?)>/si","",$str); // フォームタグをフィルタリングします$str=preg_replace("/cookie/si", "COOKIE",$ str); // COOKIE タグをフィルタリング $str=preg_replace("/<(applet.*?)>(.*?)<(/applet.*?)>/si", "",$str ); // アプレット タグのフィルタ $str=preg_replace("/<(/?applet.*?)>/si","",$str); // アプレット タグのフィルタpreg_replace("/< ;(style.*?)>(.*?)<(/style.*?)>/si","",$str); // スタイルタグをフィルタリングします $str=preg_replace ("//si","",$str); //スタイルタグをフィルター $str=preg_replace("/(. *?)< (/title.*?)>/si","",$str); //タイトルタグをフィルタリング $str=preg_replace("/<(/?title.*?)>/ si","" ,$str); //タイトルタグをフィルタリング $str=preg_replace("/<(object.*?)>(.*?)<(/object.*?)>/si ","", $str); // オブジェクト タグをフィルタリング $str=preg_replace("/<(/?objec.*?)>/si","",$str); // オブジェクト タグをフィルタリング$ str=preg_replace(" /<(noframes.*?)>(.*?)<(/noframes.*?)>/si","",$str); // noframes タグをフィルターします $str); =preg_replace("/ <(/?noframes.*?)>/si","",$str); //noframes タグをフィルタリング $str=preg_replace("/<(i?frame.*?) )>(.* ?)<(/i?frame.*?)>/si","",$str); //フレームタグをフィルタリング $str=preg_replace("/<(/?i ?frame.*?) >/si","",$str); //フィルターフレームタグ$str=preg_replace("/<(script.*?)>(.*?)<(/ script.*?)> ;/si","",$str); //スクリプトタグをフィルタリング $str=preg_replace("/<(/?script.*?)>/si","",$ str); // スクリプト タグのフィルタ $str=preg_replace("/javascript/si","Javascript",$str); // スクリプト タグのフィルタ $str=preg_replace("/vbscript/si","Vbscript",$) str); // スクリプト タグのフィルタ $str=preg_replace("/on([a-z]+)s*=/si","On\1=",$str); "//si ","",$str); //フィルタースクリプトタグ
コードをコピー

特殊文字をフィルターするためのphpの実用的な関数 PHPフォーム送信時の特殊文字フィルタリング方法 html特殊文字フィルターPHPクラス URLリンク内の特殊文字をエスケープする方法 PHPの特殊文字エスケープの詳しい説明 phpフィルターパラメータの特殊文字のアンチインジェクション 不正な特殊な文字列をフィルタリングするためのphpメソッド PHPの特殊文字処理関数の例



声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。