wp_magic_quotes

函式
wp_magic_quotes ( No parameters )
Access
Private
定義位置
相關方法
add_magic_quoteswp_favicon_requestwp_get_siteswp_maybe_auto_updateis_main_query
引入
3.0.0
棄用
-

wp_magic_quotes: 這個函式為傳入的資料新增斜線,以防止SQL隱碼攻擊。然而,從WordPress 3.6開始,它已經被棄用了,不再需要了,因為WordPress現在使用準備好的語句提供資料庫訪問,可以防止SQL隱碼攻擊。

在`$_GET`, `$_POST`, `$_COOKIE`和`$_SERVER`中加入魔力引號。

同時強制`$_REQUEST`為`$_GET + $_POST`。如果需要`$_SERVER`、`$_COOKIE`或`$_ENV`,直接使用這些超全域性變數。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_magic_quotes() {
// Escape with wpdb.
$_GET = add_magic_quotes( $_GET );
$_POST = add_magic_quotes( $_POST );
$_COOKIE = add_magic_quotes( $_COOKIE );
$_SERVER = add_magic_quotes( $_SERVER );
// Force REQUEST to be GET + POST.
$_REQUEST = array_merge( $_GET, $_POST );
}
function wp_magic_quotes() { // Escape with wpdb. $_GET = add_magic_quotes( $_GET ); $_POST = add_magic_quotes( $_POST ); $_COOKIE = add_magic_quotes( $_COOKIE ); $_SERVER = add_magic_quotes( $_SERVER ); // Force REQUEST to be GET + POST. $_REQUEST = array_merge( $_GET, $_POST ); }
function wp_magic_quotes() {
	// Escape with wpdb.
	$_GET    = add_magic_quotes( $_GET );
	$_POST   = add_magic_quotes( $_POST );
	$_COOKIE = add_magic_quotes( $_COOKIE );
	$_SERVER = add_magic_quotes( $_SERVER );

	// Force REQUEST to be GET + POST.
	$_REQUEST = array_merge( $_GET, $_POST );
}

常見問題

FAQs
檢視更多 >