{"id":6210,"date":"2022-07-17T11:05:20","date_gmt":"2022-07-17T02:05:20","guid":{"rendered":"https:\/\/nsme.red\/wp\/?p=6210"},"modified":"2024-06-11T10:36:48","modified_gmt":"2024-06-11T01:36:48","slug":"filter_input","status":"publish","type":"post","link":"https:\/\/core.nsme.net\/notes\/php\/form-php\/6210\/","title":{"rendered":"filter_input"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">form\u306e\u5024\u306e\u53d7\u3051\u53d6\u308a\u306f\u76f4\u306b\u4ee3\u5165\u3059\u308b\u3088\u308a\u3001filter_input\u3092\u4f7f\u3046\u3002<br><a href=\"https:\/\/konoti.com\/website\/php\/filter-input.html\">\u914d\u5217\u3082\u5bfe\u5fdc\uff01filter_input\u95a2\u6570\u306e\u4f7f\u3044\u65b9<\/a><br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u4f55\u3082\u3057\u306a\u3044\u5834\u5408\nfilter_input(INPUT_POST, '');\n<strong>filter_input(INPUT_POST, 'aaaa');<\/strong>\n\n\u914d\u5217\u3092\u53d7\u3051\u53d6\u308b\u5834\u5408\nfilter_input(INPUT_POST, 'bbbb',<strong> FILTER_DEFAULT, FILTER_REQUIRE_ARRAY<\/strong>);\n\n\u6587\u5b57\u5217\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u305f\u3044\u5834\u5408\n<s>filter_input(INPUT_POST, 'cccc', <strong>FILTER_SANITIZE_STRING<\/strong>);<\/s>\nPHP8.1\u304b\u3089\u975e\u63a8\u5968\u306b\u306a\u3063\u305f\u305f\u3081\u3001\nfilter_input(INPUT_POST, 'name', FILTER_SANITIZE_SPECIAL_CHARS);\ntextarea\u306enl2br\u304c\u52b9\u304b\u306a\u304f\u306a\u308b\u306e\u3067\u3001\u6539\u884c\u304c\u3042\u308b\u3082\u306e\u306f\u5225\u306e\u65b9\u6cd5\u3067\u53d6\u5f97\u3002<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>ID<\/th><th>\u8aac\u660e<\/th><\/tr><\/thead><tbody><tr><td>FILTER_SANITIZE_STRING<\/td><td>\u30bf\u30b0\u3092\u53d6\u308a\u9664\u304f\u3002\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3001 \u7279\u6b8a\u6587\u5b57\u3092\u53d6\u308a\u9664\u3044\u305f\u308a\u30a8\u30f3\u30b3\u30fc\u30c9\u3057\u305f\u308a\u3059\u308b<\/td><\/tr><tr><td>FILTER_SANITIZE_SPECIAL_CHARS<\/td><td>&#8216;&#8221;&lt;&gt;&amp; \u304a\u3088\u3073 ASCII \u5024\u304c 32 \u672a\u6e80\u306e\u6587\u5b57\u3092 HTML \u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u308b\u3002\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3001 \u7279\u6b8a\u6587\u5b57\u3092\u53d6\u308a\u9664\u3044\u305f\u308a\u30a8\u30f3\u30b3\u30fc\u30c9\u3057\u305f\u308a\u3059\u308b<\/td><\/tr><tr><td>FILTER_SANITIZE_FULL_SPECIAL_CHARS<\/td><td>htmlspecialchars() \u306b ENT_QUOTES \u3092\u6307\u5b9a\u3057\u3066\u30b3\u30fc\u30eb\u3059\u308b\u306e\u3068\u540c\u3058<\/td><\/tr><tr><td>FILTER_VALIDATE_EMAIL<\/td><td>email\u306e\u691c\u8a3c<br>\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f NULL<br>\u8aa4\u3063\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u5165\u529b\u3055\u308c\u305f\u5834\u5408\u306f\u3001FALSE <br>\u6b63\u3057\u3044\u66f8\u5f0f\u306e\u5834\u5408\u3001\u5909\u6570\u306e\u5024<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>form\u306e\u5024\u306e\u53d7\u3051\u53d6\u308a\u306f\u76f4\u306b\u4ee3\u5165\u3059\u308b\u3088\u308a\u3001filter_input\u3092\u4f7f\u3046\u3002\u914d\u5217\u3082\u5bfe\u5fdc\uff01filter_input\u95a2\u6570\u306e\u4f7f\u3044\u65b9 ID \u8aac\u660e FILTER_SANITIZE_STRING \u30bf\u30b0\u3092\u53d6\u308a\u9664\u304f\u3002\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3001 \u7279\u6b8a\u6587 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[53],"tags":[],"class_list":["post-6210","post","type-post","status-publish","format-standard","hentry","category-form-php"],"acf":[],"_links":{"self":[{"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/posts\/6210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/comments?post=6210"}],"version-history":[{"count":4,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/posts\/6210\/revisions"}],"predecessor-version":[{"id":6265,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/posts\/6210\/revisions\/6265"}],"wp:attachment":[{"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/media?parent=6210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/categories?post=6210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/tags?post=6210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}