- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
関数リファレンス/wp slash
提供: WordPress Codex 日本語版
Description
Add slashes to a string or array of strings.
This should be used when preparing data for core API that expects slashed data. This should not be used to escape data going directly into an SQL query.
Parameters
- $value
- (array or string) (必須) String or array of strings to slash..
- 初期値: なし
Return
- (array or string)
- the slashed value.
Usage
%%% <?php $value = wp_slash($value); ?> %%%
Example
How to use wp_slash with a string within your plugin.
add_action('pre_get_posts', 'toolset_string_add_slashes'); function toolset_string_add_slashes(){ $name = "O'Reilly & Associates"; $name = wp_slash($name); echo "name=$name"; }
How to use wp_slash with a string within your plugin.
add_action('pre_get_posts', 'toolset_array_add_slashes'); function toolset_array_add_slashes(){ $names = array("Baba O'Reilly", "class of '99"); $names = wp_slash($names); print_r($names); }
Change Log
- Since: 3.6.0
Source File
wp_slash() is located in wp-includes/formatting.php
.
Related
スラッシュ関連の関数: wp_slash(), wp_unslash(), stripslashes_deep(), addslashes_gpc()
この記事は翻訳時に編集が必要であるとマークされていました。その為Codex原文が大きく編集されている可能性があります。内容を確認される際は原文を参照していただき、可能であれば本項目へ反映させてください。よりよいCodexを作成するためのお手伝いをお願いします。