當前位置:編程學習大全網 - 網站源碼 - 請問PHP怎麽過濾GET或者POST的參數?防止js註入,或者壹些html註入?請請提供代碼參考?謝謝!

請問PHP怎麽過濾GET或者POST的參數?防止js註入,或者壹些html註入?請請提供代碼參考?謝謝!

string mysql_real_escape_string ( string unescaped_string [, resource link_identifier])

本函數將 unescaped_string 中的特殊字符轉義,並計及連接的當前字符集,因此可以安全用於 mysql_query()。

註: mysql_real_escape_string() 並不轉義 % 和 _。

例子 1. mysql_real_escape_string() 例子

<?php

$item = "Zak's and Derick's Laptop";

$escaped_item = mysql_real_escape_string($item);

printf ("Escaped string: %s\n", $escaped_item);

>

以上例子將產生如下輸出:

Escaped string: Zak\'s and Derick\'s Laptop

  • 上一篇:用窗函數設計FIR濾波器時怎麽定義理想高通濾波器響應函數
  • 下一篇:鑫源源代碼
  • copyright 2024編程學習大全網