{"id":510,"date":"2020-04-18T00:42:00","date_gmt":"2020-04-18T04:42:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=510"},"modified":"2021-01-02T00:44:03","modified_gmt":"2021-01-02T05:44:03","slug":"is_dir-not-working","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/is_dir-not-working\/","title":{"rendered":"is_dir not working"},"content":{"rendered":"\n<p>The is_dir() function in PHP allows users to check whether a file is a directory. It returns true if the file is a directory. However, the addresses provided must be RELATIVE TO THE CURRENT DIRECTORY. Suppose we have a directory structure as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cwd\n|-- dir1\n  |-- dir2\n     |-- dir3<\/code><\/pre>\n\n\n\n<p>where cwd is the current working directory<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>is_dir(dir1);  \/\/ returns true\nis_dir(dir2);  \/\/ returns false\nis_dir(dir1\/dir2);  \/\/ returns true<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The is_dir() function in PHP allows users to check whether a file is a directory. It returns true if the file is a directory. However, the addresses provided must be RELATIVE TO THE CURRENT DIRECTORY. Suppose we have a directory structure as follows: where cwd is the current working directory<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[24],"class_list":["post-510","post","type-post","status-publish","format-standard","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=510"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/510\/revisions"}],"predecessor-version":[{"id":511,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/510\/revisions\/511"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}