{"id":60170,"date":"2025-04-24T10:58:51","date_gmt":"2025-04-24T02:58:51","guid":{"rendered":"https:\/\/fwq.ai\/blog\/60170\/"},"modified":"2025-04-24T10:58:51","modified_gmt":"2025-04-24T02:58:51","slug":"%e8%a7%a3%e5%86%b3readdir-not-a-valid-directory-resource-in-template-php%e9%94%99%e8%af%af-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/60170\/","title":{"rendered":"\u89e3\u51b3readdir(): not a valid Directory resource in ..template.php\u9519\u8bef"},"content":{"rendered":"<p>&nbsp;\u6709\u5ba2\u6237ecshop\u7f51\u7ad9\u7a0b\u5e8f\u51fa\u73b0\u4ee5\u4e0b\u62a5\u9519\uff1a<\/p>\n<p><span><span style=\"font-size: 12px;line-height: 15px\">Warning:&nbsp;readdir():&nbsp;supplied&nbsp;argument&nbsp;is&nbsp;not&nbsp;a&nbsp;valid&nbsp;Directory&nbsp;resource&nbsp;in&nbsp;\\zuimoban\\ecshop\\admin\\template.php&nbsp;on&nbsp;line&nbsp;66<\/span><\/span><\/p>\n<p>\u5177\u4f53\u9875\u9762\u662f\u5728\u540e\u53f0\uff0cecshop\u540e\u53f0&#8212;\u6a21\u677f\u7ba1\u7406*&#8212;\u6a21\u677f\u9009\u62e9\u9876\u90e8<\/p>\n<p>\u597d\u6a21\u677f\u4e5f\u662f\u7b2c\u4e00\u6b21\u770b\u5230\uff0c\u8c37\u6b4c\u767e\u5ea6\u4e0b\u4e5f\u6ca1\u770b\u5230\u6b63\u786e\u7b54\u6848\u3002\u770b\u770b\u4ee3\u7801\uff0c\u624d\u77e5\u9053\u539f\u56e0\uff1a<\/p>\n<p>\u6211\u4eec\u627e<span style=\"font-size: 12px;line-height: 15px\">admin\\template.php&nbsp; <\/span>\u627e\u523066\u884c\u770b\u4ee3\u7801<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; <span>&nbsp;$tmp_bak_dir = @opendir(ROOT_PATH . &#8216;temp\/backup\/library\/&#8217;);<\/span><\/p>\n<p><span>&nbsp; &nbsp; while ($file = readdir($tmp_bak_dir))<\/span><\/p>\n<p><span>&nbsp; &nbsp; {<\/span><\/p>\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; if ($file != &#8216;.&#8217; &amp;&amp; $file != &#8216;..&#8217; &amp;&amp; $file != &#8216;.svn&#8217; &amp;&amp; $file != &#8216;index.htm&#8217; &amp;&amp; is_file(ROOT_PATH .&#8217;temp\/backup\/library\/&#8217; . $file) == true)<\/span><\/p>\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; {<\/span><\/p>\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $code = substr($file, 0, strpos($file, &#8216;-&#8216;));<\/span><\/p>\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!in_array($code, $available_code))<\/span><\/p>\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<\/span><\/p>\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @unlink(ROOT_PATH . &#8216;temp\/backup\/library\/&#8217; . $file);<\/span><\/p>\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/span><\/p>\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; }<\/span><\/p>\n<p><span>&nbsp; &nbsp; }<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>\u8be5\u6bb5\u4ee3\u7801\u610f\u601d \u8bfb\u53d6<span>temp\/backup\/library\/&nbsp;<\/span>\u6587\u4ef6\u5939\u4ee5\u53ca\u6587\u4ef6\uff0c\u82e5\u8be5\u6587\u4ef6\u5939\u4e0d\u5b58\u5728\uff0c\u5c31\u4f1areaddir(): &nbsp;&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5\uff1a\u68c0\u67e5<span>temp\/backup\/library\/&nbsp;<\/span>\u6587\u4ef6\u5939\u662f\u5426\u5b58\u5728\uff0c\u8865\u5168\u6587\u4ef6\u5939\u76ee\u5f55\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u6709\u5ba2\u6237ecshop\u7f51\u7ad9\u7a0b\u5e8f\u51fa\u73b0\u4ee5\u4e0b\u62a5\u9519\uff1a Warning:&nbsp;readdir():&nbsp;supplied&nbsp;argument&nbsp;is&nbsp;not&nbsp;a&nbsp;valid&nbsp;Directory&nbsp;resource&nbsp;in&nbsp;\\zuimoban\\ecshop\\admin\\template.php&nbsp;on&nbsp;line&nbsp;66 \u5177\u4f53\u9875\u9762\u662f\u5728\u540e\u53f0\uff0cecshop\u540e\u53f0&#8212;\u6a21\u677f\u7ba1\u7406*&#8212;\u6a21\u677f\u9009\u62e9\u9876\u90e8 \u597d\u6a21\u677f\u4e5f\u662f\u7b2c\u4e00\u6b21\u770b\u5230\uff0c\u8c37\u6b4c\u767e\u5ea6\u4e0b\u4e5f\u6ca1\u770b\u5230\u6b63\u786e\u7b54\u6848\u3002\u770b\u770b\u4ee3\u7801\uff0c\u624d\u77e5\u9053\u539f\u56e0\uff1a \u6211\u4eec\u627eadmin\\template.php&nbsp; \u627e\u523066\u884c\u770b\u4ee3\u7801 &nbsp; &nbsp; &nbsp;$tmp_bak_dir = @opendir(ROOT_PATH . &#8216;temp\/backup\/library\/&#8217;); &nbsp; &nbsp; while ($file = readdir($tmp_bak_dir)) &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; if ($file != &#8216;.&#8217; &amp;&amp; $file != &#8216;..&#8217; &amp;&amp; $file != &#8216;.svn&#8217; &amp;&amp; $file != &#8216;index.htm&#8217; &amp;&amp; is_file(ROOT_PATH .&#8217;temp\/backup\/library\/&#8217; . $file) == true) &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-60170","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=60170"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/60170\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=60170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=60170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=60170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}