{"id":144,"date":"2018-09-09T21:45:32","date_gmt":"2018-09-09T12:45:32","guid":{"rendered":"http:\/\/rugoh.co.jp\/blog\/?p=144"},"modified":"2021-09-09T02:29:13","modified_gmt":"2021-09-08T17:29:13","slug":"2018-09-09","status":"publish","type":"post","link":"https:\/\/rugoh.co.jp\/blog\/2018\/09\/09\/2018-09-09\/","title":{"rendered":"[FuelPHP] simpleauth\u3067logout\u3057\u3066\u3082check\u3059\u308b\u3068\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u4ef6"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-168\" src=\"http:\/\/rugoh.co.jp\/blog\/wp-content\/uploads\/2018\/09\/20180909.png\" alt=\"\" width=\"750\" height=\"500\" srcset=\"https:\/\/rugoh.co.jp\/blog\/wp-content\/uploads\/2018\/09\/20180909.png 750w, https:\/\/rugoh.co.jp\/blog\/wp-content\/uploads\/2018\/09\/20180909-300x200.png 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>simpleauth\u3067\\Auth::logout()\u3057\u3066\u3082<br \/>\n\u5225\u306e\u753b\u9762\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u30ed\u30b0\u30a4\u30f3\u3055\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u4e8b\u8c61\u3067\u30cf\u30de\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre>Class Member extends \\Controller\n{\n  public function action_logout()\n  {\n    \\Auth::logout();\n    var_dump( \\Auth::check());\n    exit;\n  }\n  public function action_login()\n  {\n    var_dump( \\Auth::check());\n    exit;\n  }\n}\n<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306a\u7c21\u5358\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u307f\u307e\u3059\u3002<br \/>\nlogout\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u7d50\u679c\u306f<\/p>\n<pre>bool(false)\n<\/pre>\n<p>\u3064\u307e\u308a\u30ed\u30b0\u30a2\u30a6\u30c8\u3055\u308c\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u304c\u3001<br \/>\n\u305d\u306e\u5f8c\u3001login\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068<\/p>\n<pre>bool(true)\n<\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u3002<br \/>\n\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u305f\u306f\u305a\u306a\u306e\u306b\uff01<\/p>\n<p>\u6d88\u3057\u3066\u3082\u6d88\u3057\u3066\u3082\u307e\u308b\u3067\u4ea1\u970a\u306e\u3088\u3046\u306bSession\u304c\u6b8b\u3063\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u3002<br \/>\n\u3044\u307e\u307e\u3067\u6c17\u306b\u3082\u3057\u306a\u304b\u3063\u305fFuelPHP\u306e\u524d\u51e6\u7406\u3067\u3001<br \/>\n\u52dd\u624b\u306b\u51e6\u7406\u3057\u3066\u308b\u306e\u304b\u3068\u63a2\u3057\u307e\u304f\u308b\u3082\u3069\u3046\u3082\u305d\u308c\u3089\u3057\u3044\u3068\u3053\u308d\u306f\u306a\u3044\u3002<\/p>\n<p>\u5b9f\u306f\u3001\u56f0\u3063\u305f\u306e\u304c\u3001opAuth\u3068\u9023\u643a\u3057\u3066\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u6642\u3002<br \/>\n\u30e1\u30a2\u30c9\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u30a2\u30ab\u30a6\u30f3\u30c81\u3067\u30ed\u30b0\u30a4\u30f3\u5f8c\u3001\u30ed\u30b0\u30a2\u30a6\u30c8\u3002<br \/>\n\u305d\u306e\u5f8c\u3001\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u3092\u8a66\u3059\u3068\u3001\u52dd\u624b\u306b\u30a2\u30ab\u30a6\u30f3\u30c81\u306b\u7d10\u3065\u3044\u3061\u3083\u3046\u3093\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u6b63\u89e3\u306f\u3001\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u304b\u3089\u5f97\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067<br \/>\n\u65b0\u3057\u3044\u30a2\u30ab\u30a6\u30f3\u30c82\u3092\u4f5c\u3063\u3066\u6b32\u3057\u3044\u3002<\/p>\n<p>\u3067\u3001\u307e\u3041\u3001apAuth\u3084Auth\u3001SimpleAuth\u304b\u3089Session\u307e\u3067\u5168\u90e8\u8abf\u3079\u3066\u3082<br \/>\n\u539f\u56e0\u304c\u308f\u304b\u3089\u305a\u3001\u305d\u308c\u305e\u308c\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u898b\u76f4\u3059\u3068<\/p>\n<h3>config\/simpleauth.php\u306eremember_me\u304c\u539f\u56e0<\/h3>\n<p>\u3067\u3057\u305f\u3002<\/p>\n<p>remenber_me\u3068\u306f\u3001\u6700\u521d\u306f\u5168\u7136\u671f\u5f85\u3057\u3066\u306a\u304b\u3063\u305f\u3051\u3069<br \/>\n\u3044\u3056\u898b\u305f\u3089\u30e9\u30b9\u30c8\u306f\u53f7\u6ce3\u306e\u3042\u306e\u6620\u753b\u3067\u306f\u306a\u304f\u3001<\/p>\n<h4 id=\"method_remember_me\" class=\"method\"><a class=\"internal_link\" href=\"http:\/\/fuelphp.jp\/docs\/1.7\/packages\/auth\/simpleauth\/usage.html#\/method_remember_me\">remember_me($user_id = null)<\/a><\/h4>\n<p><strong>remember_me<\/strong>\u00a0\u30e1\u30bd\u30c3\u30c9\u306f\u3001 remember_me \u30af\u30c3\u30ad\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 $user_id \u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u73fe\u5728\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u30e6\u30fc\u30b6\u30fc\u304c\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n<table class=\"method\">\n<tbody>\n<tr>\n<th class=\"legend\">\u9759\u7684<\/th>\n<td>\u306f\u3044<\/td>\n<\/tr>\n<tr>\n<th>\u30d1\u30e9\u30e1\u30fc\u30bf<\/th>\n<td>\n<table class=\"parameters\">\n<tbody>\n<tr>\n<th>\u30d1\u30e9\u30e1\u30fc\u30bf<\/th>\n<th>\u30c7\u30d5\u30a9\u30eb\u30c8<\/th>\n<th class=\"description\">\u30d1\u30e9\u30e1\u30fc\u30bf<\/th>\n<\/tr>\n<tr>\n<th><kbd>$user_id<\/kbd><\/th>\n<td>\n<pre class=\"php\"><code class=\"php\" data-result=\"[object Object]\"><span class=\"keyword\">null<\/span><\/code><\/pre>\n<\/td>\n<td>\u8a18\u61b6\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u306e id<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<th>\u8fd4\u308a\u5024<\/th>\n<td>boolean\u3002\u6b63\u3057\u304f remember me \u30af\u30c3\u30ad\u30fc\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308c\u3070\u00a0<strong>true<\/strong>\u00a0\u3092\u3001 user_id \u304c\u5b58\u5728\u3057\u306a\u3044\u304b remember_me \u6a5f\u80fd\u304c\u8a2d\u5b9a\u3067\u7121\u52b9\u306b\u306a\u3063\u3066\u3044\u308b\u5834\u5408\u00a0<strong>false<\/strong>\u00a0\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u3046\u3044\u3046\u6a5f\u80fd\u3060\u305d\u3046\u3067\u3059\u3002<br \/>\n\u4fbf\u5229\u305d\u3046\u3060\u306e\u3067\u3001true\u306b\u3057\u3066\u305f\u306e\u3092\u3059\u3063\u304b\u308a\u5fd8\u308c\u3066\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3044\u3064\u3092false\u306b\u3057\u305f\u3089\u3001\u554f\u984c\u306f\u89e3\u6d88\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\\Auth::logout()\u306f\u3001<\/p>\n<pre>\\Session::delete('username');\n\\Session::delete('login_hash');\n<\/pre>\n<p>\u3053\u3093\u306a\u3053\u3068\u3057\u304b\u3057\u3066\u306a\u3044\u306e\u3067\u3001<br \/>\nremember_me\u304ctrue\u306e\u8a2d\u5b9a\u3060\u3068\u3001\u30ed\u30b0\u30a4\u30f3\u60c5\u5831\u304cCookie\u306b\u66f8\u304d\u8fbc\u307e\u308c\u3066\u3044\u3066<br \/>\n\u6b63\u5e38\u306b\u6a5f\u80fd\u3057\u306a\u3044\u3063\u3066\u4e8b\u306b\u306a\u308a\u307e\u3059\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>simpleauth\u3067\\Auth::logout()\u3057\u3066\u3082 \u5225\u306e\u753b\u9762\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u30ed\u30b0\u30a4\u30f3\u3055\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u4e8b\u8c61\u3067\u30cf\u30de\u308a&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":168,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,10],"tags":[18,13,17,16],"_links":{"self":[{"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/posts\/144"}],"collection":[{"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=144"}],"version-history":[{"count":3,"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"predecessor-version":[{"id":169,"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/posts\/144\/revisions\/169"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/media\/168"}],"wp:attachment":[{"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rugoh.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}