1. 首页
  2. WordPress 函数手册

addslashes_gpc()

addslashes_gpc( string $gpc )

添加斜线以转义字符串。
Adds slashes to escape strings.

目录锚点:#说明#参数#返回#源码


说明(Description)

如果设置了magic_quotes_gpc,将首先删除斜线,请参见https://www.php.net/magic_quotes更多细节。


参数(Parameters)

参数 类型 必填 说明
$gpc (string) 必需 从HTTP请求数据返回的字符串。

返回(Return)

(string)返回用斜杠转义的string。


源码(Source)

/**
 * Adds slashes to escape strings.
 *
 * Slashes will first be removed if magic_quotes_gpc is set, see {@link
 * http://www.php.net/magic_quotes} for more details.
 *
 * @since 0.71
 *
 * @param string $gpc The string returned from HTTP request data.
 * @return string Returns a string escaped with slashes.
 */
function addslashes_gpc($gpc) {
	if ( get_magic_quotes_gpc() )
		$gpc = stripslashes($gpc);

	return wp_slash($gpc);
}
更新版本 源码位置 使用 被使用
0.71 wp-includes/formatting.php:2719 1 function 1 function

addslashes_gpc() 为WP2原创文章,链接:https://www.wp2.cn/functions/addslashes_gpc/