{"id":285,"date":"2017-03-06T13:54:39","date_gmt":"2017-03-06T05:54:39","guid":{"rendered":"http:\/\/blog.inforere.com\/?p=285"},"modified":"2017-03-06T13:54:39","modified_gmt":"2017-03-06T05:54:39","slug":"%e8%ae%b0%e5%bd%95%e4%b8%80%e4%b8%8bstatic%e7%b1%bb%e5%9e%8b%e7%9a%84bug","status":"publish","type":"post","link":"https:\/\/blog.inforere.com\/?p=285","title":{"rendered":"\u8bb0\u5f55\u4e00\u4e0bstatic\u7c7b\u578b\u7684bug"},"content":{"rendered":"<pre class=\"lang:php decode:true \">      try{\r\n            static $instances;\r\n            if(!isset($instances)){\r\n                $dbLink = new StatDBLink(\r\n                    $this-&gt;options['db_host'],\r\n                    $this-&gt;options['db_user'],\r\n                    $this-&gt;options['db_pwd']\r\n                    );\r\n                $dbo = new StatDbo($dbLink);\r\n                $dbo-&gt;isDebug = $this-&gt;isDebug();\r\n\r\n                $tools = new StatTools($dbo);\r\n                $ip = new StatIpLocation(__DIR__ . '\/QQWry.Dat');\r\n                $region = new StatArea();\r\n                $instances = new StatLog($tools, $ip, $region);\r\n            }\r\n\r\n            $this-&gt;isDebug()\r\n                &amp;&amp; $this-&gt;log(var_export($data, true));\r\n\r\n            $instances-&gt;add($data);\r\n        } catch(Exception $e){\r\n            $this-&gt;log($e-&gt;getMessage());\r\n            $this-&gt;logError($e-&gt;getMessage());\r\n            \/\/ \u6e05\u7406\u8d44\u6e90\uff0c\u5728swoole\u4e0b\u7279\u522b\u6ce8\u610f\uff0c\u7ecf\u5e38unset()\u4e0d\u9700\u8981\u7684\u53d8\u91cf\r\n            unset($instances);\r\n            if(isset($dbLink)){\r\n                $dbLink-&gt;close();\r\n                unset($dbLink);\r\n            }\r\n        }<\/pre>\n<p>\u5728\u53d1\u751fException\u540e\uff0cstatic\u7c7b\u578b\u7684\u53d8\u91cfinstances\u672a\u88abunset<\/p>\n","protected":false},"excerpt":{"rendered":"<p>try{ static $instances; if(!isset($instances)){ $dbLink [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[35],"_links":{"self":[{"href":"https:\/\/blog.inforere.com\/index.php?rest_route=\/wp\/v2\/posts\/285"}],"collection":[{"href":"https:\/\/blog.inforere.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.inforere.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.inforere.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.inforere.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=285"}],"version-history":[{"count":1,"href":"https:\/\/blog.inforere.com\/index.php?rest_route=\/wp\/v2\/posts\/285\/revisions"}],"predecessor-version":[{"id":286,"href":"https:\/\/blog.inforere.com\/index.php?rest_route=\/wp\/v2\/posts\/285\/revisions\/286"}],"wp:attachment":[{"href":"https:\/\/blog.inforere.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.inforere.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.inforere.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}