-
-
- $str=$_POST["str"]; //strの内容を読み込み、$str変数に代入します
- if(get_magic_quotes_gpc()){ //If get_magic_quotes_gpc()がオンになっています
- $str=stripslashes($str); //文字列を処理します
- }
コードをコピーします
この問題を解決する 3 つの方法を以下に紹介します:
1. PHP 設定ファイル php.ini を変更します。
この方法は、サーバーを管理する権限がある場合にのみ適しています。仮想空間を使用する場合は、最後の 2 つの方法のみを使用できます。
PHP 構成ファイル php.ini で、magic_quotes_gpc、magic_quotes_runtime、および magic_quotes_sybase を off に設定します。
次のように:
-
- if(get_magic_quotes_gpc()){
- functiontripslashes_deep($value){
- $value=is_array($value)?array_map('stripslashes_deep',$value):stripslashes($value) );
- $value を返す
- }
- $_POST=array_map('stripslashes_deep',$_GET);
- $_COOKIE=array_map('stripslashes_deep',$_COOKIE) ;
- $_REQUEST=array_map('stripslashes_deep',$_REQUEST)
- }
-
-
コードをコピーします
;
|