{"id":804,"date":"2025-08-04T16:23:00","date_gmt":"2025-08-04T07:23:00","guid":{"rendered":"https:\/\/nexive.tech\/?p=804"},"modified":"2025-08-04T16:23:00","modified_gmt":"2025-08-04T07:23:00","slug":"%e3%80%90%e3%82%b5%e3%82%af%e3%83%83%e3%81%a8%e8%a7%a3%e8%aa%ac%e3%80%91php-cookie%e3%81%ae%e5%9f%ba%e6%9c%ac%e3%81%a8%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3%e7%b6%ad%e6%8c%81%e3%81%ae%e4%bd%bf%e3%81%84","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=804","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011PHP cookie\u306e\u57fa\u672c\u3068\u30ed\u30b0\u30a4\u30f3\u7dad\u6301\u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP\u306b\u304a\u3051\u308bCookie\u306e\u57fa\u672c\u64cd\u4f5c\uff08\u4fdd\u5b58\u30fb\u53d6\u5f97\u30fb\u524a\u9664\uff09\u3092\u89e3\u8aac<\/li>\n\n\n\n<li>\u30ed\u30b0\u30a4\u30f3\u72b6\u614b\u306e\u7dad\u6301\u306a\u3069\u3001\u5b9f\u52d9\u7684\u306a\u7528\u9014\u3067\u306e\u6d3b\u7528\u65b9\u6cd5\u3092\u7d39\u4ecb<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3084\u6709\u52b9\u671f\u9650\u306a\u3069\u3001Cookie\u4f7f\u7528\u6642\u306e\u6ce8\u610f\u70b9\u3082\u88dc\u8db3<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. PHP\u306eCookie\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>Cookie\uff08\u30af\u30c3\u30ad\u30fc\uff09\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u30d6\u30e9\u30a6\u30b6\u306b\u4e00\u6642\u7684\u306a\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002PHP\u3067\u306f\u3001<code>setcookie()<\/code>\u95a2\u6570\u3092\u4f7f\u3063\u3066Cookie\u3092\u9001\u4fe1\u3057\u3001<code>$_COOKIE<\/code>\u30b9\u30fc\u30d1\u30fc\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092\u901a\u3058\u3066\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b5\u30fc\u30d0\u30fc\u3068\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u9593\u3067\u72b6\u614b\u3092\u4fdd\u6301\u3057\u306a\u3044HTTP\u306e\u6027\u8cea\u4e0a\u3001\u30ed\u30b0\u30a4\u30f3\u72b6\u614b\u3084\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a\u306a\u3069\u3092\u7dad\u6301\u3059\u308b\u305f\u3081\u306bCookie\u304c\u5229\u7528\u3055\u308c\u307e\u3059\u3002\u4fdd\u5b58\u3055\u308c\u308b\u60c5\u5831\u306f\u6587\u5b57\u5217\u3067\u3042\u308a\u3001\u30d5\u30a1\u30a4\u30eb\u3084\u914d\u5217\u306a\u3069\u306e\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u306f\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u3057\u3066\u4fdd\u5b58\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>Cookie\u306f\u30ec\u30b9\u30dd\u30f3\u30b9\u30d8\u30c3\u30c0\u3067\u9001\u4fe1\u3055\u308c\u308b\u305f\u3081\u3001<code>setcookie()<\/code>\u306f<code>echo<\/code>\u306a\u3069\u306e\u51fa\u529b\u3088\u308a\u3082\u524d\u306b\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u306a\u304a\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f37\u5316\u306e\u305f\u3081\u3001<code>HttpOnly<\/code>\u3084<code>Secure<\/code>\u3068\u3044\u3063\u305f\u30aa\u30d7\u30b7\u30e7\u30f3\u3082\u9069\u5207\u306b\u8a2d\u5b9a\u3059\u3079\u304d\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u8a73\u7d30\u89e3\u8aac<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Cookie\u3092\u4fdd\u5b58\u3059\u308b\uff08\u30ed\u30b0\u30a4\u30f3\u60c5\u5831\u306a\u3069\u3092\u4fdd\u6301\uff09<\/h3>\n\n\n\n<p><code>setcookie()<\/code>\u3092\u4f7f\u3063\u3066\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u57fa\u672c\u7684\u306a\u69cb\u6587\u3067\u3059\uff1a<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\n\/\/ \u540d\u524d\u3001\u5024\u3001\u6709\u52b9\u671f\u9650\u3092\u6307\u5b9a\u3057\u3066Cookie\u3092\u30bb\u30c3\u30c8\uff081\u6642\u9593\u5f8c\u307e\u3067\u6709\u52b9\uff09\nsetcookie(\"user_id\", \"12345\", time() + 3600, \"\/\", \"\", true, true);\n?>\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u540d\u524d\u3001\u5024\u3001\u6709\u52b9\u671f\u9650\u3092\u6307\u5b9a\u3057\u3066Cookie\u3092\u30bb\u30c3\u30c8\uff081\u6642\u9593\u5f8c\u307e\u3067\u6709\u52b9\uff09<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">setcookie<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;user_id&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;12345&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #DCDCAA\">time<\/span><span style=\"color: #D4D4D4\">() + <\/span><span style=\"color: #B5CEA8\">3600<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;\/&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #569CD6\">true<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #569CD6\">true<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b2c1\u5f15\u6570\uff1aCookie\u540d<\/li>\n\n\n\n<li>\u7b2c2\u5f15\u6570\uff1a\u4fdd\u5b58\u3059\u308b\u5024\uff08\u6587\u5b57\u5217\uff09<\/li>\n\n\n\n<li>\u7b2c3\u5f15\u6570\uff1a\u6709\u52b9\u671f\u9650\uff08Unix\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\uff09<\/li>\n\n\n\n<li>\u7b2c6\u5f15\u6570\uff1aSecure\uff08HTTPS\u306e\u307f\u9001\u4fe1\uff09<\/li>\n\n\n\n<li>\u7b2c7\u5f15\u6570\uff1aHttpOnly\uff08JavaScript\u304b\u3089\u30a2\u30af\u30bb\u30b9\u4e0d\u53ef\uff09<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Cookie\u3092\u53d6\u5f97\u3059\u308b\uff08\u30ed\u30b0\u30a4\u30f3\u72b6\u614b\u306e\u78ba\u8a8d\u306a\u3069\uff09<\/h3>\n\n\n\n<p>\u4fdd\u5b58\u3055\u308c\u305fCookie\u306f<code>$_COOKIE<\/code>\u304b\u3089\u53c2\u7167\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nif (isset($_COOKIE&#91;'user_id'&#93;)) {\n    echo \"\u30e6\u30fc\u30b6\u30fcID\uff1a\" . $_COOKIE&#91;'user_id'&#93;;\n} else {\n    echo \"Cookie\u306f\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\";\n}\n?>\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #DCDCAA\">isset<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$_COOKIE<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&#39;user_id&#39;<\/span><span style=\"color: #D4D4D4\">&#93;)) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u30e6\u30fc\u30b6\u30fcID\uff1a&quot;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$_COOKIE<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&#39;user_id&#39;<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;Cookie\u306f\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u30d6\u30e9\u30a6\u30b6\u304cCookie\u3092\u9001\u4fe1\u3059\u308b\u306e\u306f\u3001\u6b21\u56de\u4ee5\u964d\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u6642\u3067\u3059\u3002<br>\u540c\u4e00\u30b9\u30af\u30ea\u30d7\u30c8\u5185\u3067\u5373\u5ea7\u306b\u53cd\u6620\u306f\u3055\u308c\u306a\u3044\u70b9\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cookie\u3092\u524a\u9664\u3059\u308b\uff08\u30ed\u30b0\u30a2\u30a6\u30c8\u51e6\u7406\u306a\u3069\uff09<\/h3>\n\n\n\n<p>\u6709\u52b9\u671f\u9650\u3092\u904e\u53bb\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\n\/\/ Cookie\u3092\u524a\u9664\uff08\u6709\u52b9\u671f\u9650\u3092\u904e\u53bb\u306b\u8a2d\u5b9a\uff09\nsetcookie(\"user_id\", \"\", time() - 3600, \"\/\");\n?>\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ Cookie\u3092\u524a\u9664\uff08\u6709\u52b9\u671f\u9650\u3092\u904e\u53bb\u306b\u8a2d\u5b9a\uff09<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">setcookie<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;user_id&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #DCDCAA\">time<\/span><span style=\"color: #D4D4D4\">() - <\/span><span style=\"color: #B5CEA8\">3600<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;\/&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u64cd\u4f5c\u306b\u3088\u308a\u3001\u30d6\u30e9\u30a6\u30b6\u306f\u8a72\u5f53\u306eCookie\u3092\u7834\u68c4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u3088\u304f\u3042\u308b\u30df\u30b9\u30fb\u8aa4\u89e3\u30fb\u843d\u3068\u3057\u7a74<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u51fa\u529b\u3088\u308a\u524d\u306bsetcookie()\u3092\u547c\u3070\u306a\u3044\u3068\u7121\u52b9<\/strong>\uff1a<code>setcookie()<\/code>\u306fHTTP\u30d8\u30c3\u30c0\u3068\u3057\u3066\u9001\u4fe1\u3055\u308c\u308b\u305f\u3081\u3001HTML\u51fa\u529b\u5f8c\u306b\u306f\u4f7f\u3048\u307e\u305b\u3093\u3002<\/li>\n\n\n\n<li><strong>\u6709\u52b9\u671f\u9650\u304c\u77ed\u3059\u304e\u308b<\/strong>\uff1a\u30ed\u30b0\u30a4\u30f3\u7dad\u6301\u76ee\u7684\u3067\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001\u6570\u6642\u9593\u301c\u6570\u65e5\u5358\u4f4d\u306e\u6709\u52b9\u671f\u9650\u3092\u8a2d\u3051\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>Secure\/HttpOnly\u306e\u672a\u8a2d\u5b9a<\/strong>\uff1a\u3053\u308c\u3089\u3092\u8a2d\u5b9a\u3057\u306a\u3044\u3068\u3001XSS\u306a\u3069\u306e\u8105\u5a01\u306b\u5bfe\u3057\u3066\u8106\u5f31\u306b\u306a\u308a\u307e\u3059\u3002\u7279\u306b\u30ed\u30b0\u30a4\u30f3\u60c5\u5831\u3092\u6271\u3046Cookie\u3067\u306f\u5fc5\u9808\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30d6\u30e9\u30a6\u30b6\u306e\u5236\u9650\u3084SameSite\u5c5e\u6027\u306e\u672a\u8003\u616e<\/strong>\uff1a\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u8981\u4ef6\u3084\u6700\u8fd1\u306e\u30d6\u30e9\u30a6\u30b6\u5236\u9650\u3092\u7121\u8996\u3059\u308b\u3068\u3001Cookie\u304c\u671f\u5f85\u901a\u308a\u9001\u4fe1\u3055\u308c\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<p>PHP\u306b\u304a\u3051\u308bCookie\u306e\u64cd\u4f5c\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u304c\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a\u3084\u5b9f\u884c\u30bf\u30a4\u30df\u30f3\u30b0\u306a\u3069\u3001\u4ed5\u69d8\u4e0a\u306e\u5236\u7d04\u306b\u6ce8\u610f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u7279\u306b\u30ed\u30b0\u30a4\u30f3\u7dad\u6301\u306a\u3069\u306e\u7528\u9014\u3067\u306f\u3001<code>setcookie()<\/code>\u306e\u9069\u5207\u306a\u4f7f\u3044\u65b9\u3068\u3001Secure\/HttpOnly\u5c5e\u6027\u306e\u4f75\u7528\u304c\u91cd\u8981\u3067\u3059\u3002\u53d6\u5f97\u306b\u306f<code>$_COOKIE<\/code>\u3092\u4f7f\u3044\u3001\u524a\u9664\u6642\u306b\u306f\u671f\u9650\u3092\u904e\u53bb\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. PHP\u306eCookie\u3068\u306f\uff1f Cookie\uff08\u30af\u30c3\u30ad\u30fc\uff09\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u30d6\u30e9\u30a6\u30b6\u306b\u4e00\u6642\u7684\u306a\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002PHP\u3067\u306f\u3001setcookie()\u95a2\u6570\u3092\u4f7f\u3063\u3066Cookie\u3092\u9001\u4fe1\u3057\u3001$_ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":720,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[85],"tags":[],"class_list":["post-804","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=804"}],"version-history":[{"count":2,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/804\/revisions"}],"predecessor-version":[{"id":884,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/804\/revisions\/884"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/720"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}