{"id":74,"date":"2012-11-28T18:34:41","date_gmt":"2012-11-28T10:34:41","guid":{"rendered":"http:\/\/www.yeetrack.com\/php\u4e2d\u6587\u4ef6\u7684\u5c5e\u6027\u53ca\u65b9\u6cd5"},"modified":"2013-04-20T17:24:41","modified_gmt":"2013-04-20T09:24:41","slug":"php%e4%b8%ad%e6%96%87%e4%bb%b6%e7%9a%84%e5%b1%9e%e6%80%a7%e5%8f%8a%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=74","title":{"rendered":"php\u4e2d\u6587\u4ef6\u7684\u5c5e\u6027\u53ca\u65b9\u6cd5"},"content":{"rendered":"<p>\u6587\u4ef6\u90fd\u6709\u76f8\u5e94\u7684\u5c5e\u6027\uff0c\u6587\u4ef6\u5927\u5c0f\u3001\u6587\u4ef6\u7c7b\u578b\u3001\u4fee\u6539\u65f6\u95f4\u3001\u521b\u5efa\u65f6\u95f4\u3001\u8bfb\u5199\u6743\u9650\u7b49\u3002<\/p>\n<p><!--more--><\/p>\n<p>php\u63d0\u4f9b\u83b7\u53d6\u8fd9\u4e9b\u5c5e\u6027\u7684\u51fd\u6570\u3002<\/p>\n<ul class=\"edui-filter-disc\">\n<li>\n<p>file_exists() \u68c0\u67e5\u6307\u5b9a\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u662f\u5426\u5b58\u5728\u3002<\/p>\n<\/li>\n<li>\n<p>filesize() \u83b7\u53d6\u6587\u4ef6\u7684\u5927\u5c0f\uff0c\u5355\u4f4d\u662fB\uff08\u5b57\u8282\uff09\u3002<\/p>\n<\/li>\n<li>\n<p>is_readable() \u68c0\u67e5\u6587\u4ef6\u662f\u5426\u53ef\u8bfb\u3002<\/p>\n<\/li>\n<li>\n<p>is_writable() \u68c0\u67e5\u6587\u4ef6\u662f\u5426\u53ef\u5199\u3002<\/p>\n<\/li>\n<li>\n<p>is_executable() \u68c0\u67e5\u6587\u4ef6\u662f\u5426\u53ef\u6267\u884c<\/p>\n<\/li>\n<li>\n<p>filectime() \u83b7\u53d6\u6587\u4ef6\u7684\u521b\u5efa\u65f6\u95f4\uff0c\u8fd4\u56deUnix\u65f6\u95f4\u6233\u3002<\/p>\n<\/li>\n<li>\n<p>filemtime() \u83b7\u53d6\u6587\u4ef6\u7684\u6700\u540e\u4fee\u6539\u65f6\u95f4\uff0c\u8fd4\u56deUnix\u65f6\u95f4\u6233\u3002<\/p>\n<\/li>\n<li>\n<p>fileatime() \u83b7\u53d6\u6587\u4ef6\u7684\u6700\u540e\u8bbf\u95ee\u65f6\u95f4\uff0c\u8fd4\u56deUnix\u65f6\u95f4\u6233\u3002<\/p>\n<\/li>\n<li>\n<p>stat() \u83b7\u53d6\u6587\u4ef6\u7684\u5927\u90e8\u5206\u5c5e\u6027\uff0c\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre config=\"brush:php;toolbar:false;\">&lt;?php \n        \n    \/**\n     * @author youthflies\n     * \u83b7\u53d6\u6587\u4ef6\u7684\u5c5e\u6027\n     *\/\n    $fileName = &quot;\/home\/youthflies\/downloads\/jdk-6u37-linux-i586.bin&quot;;\n        \n    if(!file_exists($fileName))\n    {\n        echo &quot;File do not exists!&quot;;\n        return;\n    }\n        \n    echo &quot;File size : &quot; . filesize($fileName) . &quot;&lt;br \/&gt;&quot;;\n    echo &quot;File read : &quot; . is_readable($fileName) . &quot;&lt;br \/&gt;&quot;;\n    echo &quot;File write : &quot; . is_writable($fileName) . &quot;&lt;br \/&gt;&quot;;\n    echo &quot;File execute : &quot; . is_executable($fileName) . &quot;&lt;br \/&gt;&quot;;\n    echo &quot;File created time : &quot; . date(&quot;Y-m-d h:i:s&quot;, filectime($fileName)) . &quot;&lt;br \/&gt;&quot;;\n    echo &quot;File modified time : &quot; . date(&quot;Y-m-d h:i:s&quot;, filemtime($fileName)) . &quot;&lt;br \/&gt;&quot;;\n    echo &quot;File acess time : &quot; . date(&quot;Y-m-d h:i:s&quot;, fileatime($fileName)) . &quot;&lt;br \/&gt;&quot;;\n    echo &quot;File properties : &quot;;\n    print_r(stat($fileName));\n        \n    \n?&gt;<\/pre>\n<p>\u4e0a\u9762\u6587\u4ef6\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p>File size : 71764073<br \/>File read : 1<br \/>File write : 1<br \/>File execute : 1<br \/>File created time : 2012-11-28 02:20:19<br \/>File modified time : 2012-11-27 02:13:01<br \/>File acess time : 2012-11-27 02:15:22<br \/>File properties : Array( &nbsp;&nbsp;&nbsp;[0] =&gt; 2055 &nbsp;&nbsp;&nbsp;[1] =&gt; 2228791 &nbsp;&nbsp;&nbsp;[2] =&gt; 33279 &nbsp;&nbsp;&nbsp;[3] =&gt; 1 &nbsp;&nbsp;&nbsp;[4] =&gt; 1000 &nbsp;&nbsp;&nbsp;[5] =&gt; 1000 &nbsp;&nbsp;&nbsp;[6] =&gt; 0 &nbsp;&nbsp;&nbsp;[7] =&gt; 71764073 &nbsp;&nbsp;&nbsp;[8] =&gt; 1353996922 &nbsp;&nbsp;&nbsp;[9] =&gt; 1353996781 &nbsp;&nbsp;&nbsp;[10] =&gt; 1354083619 &nbsp;&nbsp;&nbsp;[11] =&gt; 4096 &nbsp;&nbsp;&nbsp;[12] =&gt; 140168 &nbsp;&nbsp;&nbsp;[dev] =&gt; 2055 &nbsp;&nbsp;&nbsp;[ino] =&gt; 2228791 &nbsp;&nbsp;&nbsp;[mode] =&gt; 33279 &nbsp;&nbsp;&nbsp;[nlink] =&gt; 1 &nbsp;&nbsp;&nbsp;[uid] =&gt; 1000 &nbsp;&nbsp;&nbsp;[gid] =&gt; 1000 &nbsp;&nbsp;&nbsp;[rdev] =&gt; 0 &nbsp;&nbsp;&nbsp;[size] =&gt; 71764073 &nbsp;&nbsp;&nbsp;[atime] =&gt; 1353996922 &nbsp;&nbsp;&nbsp;[mtime] =&gt; 1353996781 &nbsp;&nbsp;&nbsp;[ctime] =&gt; 1354083619 &nbsp;&nbsp;&nbsp;[blksize] =&gt; 4096 &nbsp;&nbsp;&nbsp;[blocks] =&gt; 140168) <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u4ef6\u90fd\u6709\u76f8\u5e94\u7684\u5c5e\u6027\uff0c\u6587\u4ef6\u5927\u5c0f\u3001\u6587\u4ef6\u7c7b\u578b\u3001\u4fee\u6539\u65f6\u95f4\u3001\u521b\u5efa\u65f6\u95f4\u3001\u8bfb\u5199\u6743\u9650\u7b49\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[33],"tags":[24,7],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-coding","tag-php","tag-7"],"views":3386,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":2,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":384,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions\/384"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}