{"id":474,"date":"2025-06-10T20:58:54","date_gmt":"2025-06-10T12:58:54","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/php\/php-application-manual\/jcyy\/474.html"},"modified":"2025-06-10T20:58:54","modified_gmt":"2025-06-10T12:58:54","slug":"%e4%bf%ae%e5%a4%8d-composer-%e9%94%99%e8%af%af%ef%bc%9aphp-%e6%89%a9%e5%b1%95fileinfo%e7%bc%ba%e5%a4%b1","status":"publish","type":"my1js","link":"https:\/\/www.zhaozhao123.cn\/php\/my1js\/474.html","title":{"rendered":"\u4fee\u590d Composer \u9519\u8bef\uff1aPHP \u6269\u5c55\u2018fileinfo\u2019\u7f3a\u5931"},"content":{"rendered":"<p><body><\/p>\n<h2>&#38382;&#39064;<\/h2>\n<p>&#22914;&#26524;&#20320;&#26159;&#19968;&#21517;PHP&#24320;&#21457;&#20154;&#21592;&#65292;&#22312;&#20351;&#29992;Composer&#65288;PHP&#30340;&#20381;&#36182;&#31649;&#29702;&#24037;&#20855;&#65289;&#26102;&#65292;&#21487;&#33021;&#20250;&#36935;&#21040;&ldquo;PHP&#25193;&#23637;&lsquo;fileinfo&rsquo;&#32570;&#22833;&rdquo;&#30340;&#20196;&#20154;&#27822;&#20007;&#30340;&#38169;&#35823;&#28040;&#24687;&#12290;&#36825;&#20010;&#38169;&#35823;&#21487;&#33021;&#23548;&#33268;&#23433;&#35013;&#25110;&#26356;&#26032;PHP&#21253;&#30340;&#20013;&#26029;&#65292;&#20174;&#32780;&#38459;&#30861;&#39033;&#30446;&#36827;&#24230;&#12290;&#22312;&#26412;&#25351;&#21335;&#20013;&#65292;&#25105;&#20204;&#23558;&#19968;&#27493;&#27493;&#22320;&#35299;&#20915;&#36825;&#20010;&#38382;&#39064;&#12290;<\/p>\n<h3>&#29702;&#35299;&#38169;&#35823;<\/h3>\n<p>&#22312;&#28145;&#20837;&#35299;&#20915;&#26041;&#26696;&#20043;&#21069;&#65292;&#29702;&#35299;&#38169;&#35823;&#26412;&#36523;&#38750;&#24120;&#37325;&#35201;&#12290;Composer &#29992;&#20110;&#31649;&#29702; PHP &#24212;&#29992;&#31243;&#24207;&#30340;&#20381;&#36182;&#39033;&#65292;&#32780;&#23427;&#25552;&#21040;&#30340; &#8216;fileinfo&#8217; &#25193;&#23637;&#26159;&#19968;&#20010;&#26680;&#24515; PHP &#25193;&#23637;&#65292;&#25552;&#20379;&#20102;&#35768;&#22810;&#19982;&#25991;&#20214;&#30456;&#20851;&#30340;&#21151;&#33021;&#12290;&#36825;&#20010;&#38169;&#35823;&#36890;&#24120;&#26159;&#22240;&#20026;&#24744;&#30340; PHP &#23433;&#35013;&#37197;&#32622;&#20013;&#27809;&#26377;&#21551;&#29992; &#8216;fileinfo&#8217; &#25193;&#23637;&#12290;<\/p>\n<h3>&#20808;&#20915;&#26465;&#20214;<\/h3>\n<p>&#23545;php.ini&#25991;&#20214;&#30340;&#35775;&#38382;&#26435;&#38480;&#25110;&#36816;&#34892;PHP&#21629;&#20196;&#30340;&#33021;&#21147;&#12290;<\/p>\n<p>&#24744;&#30340;&#26381;&#21153;&#22120;&#25110;&#26412;&#22320;&#24320;&#21457;&#29615;&#22659;&#20013;&#24050;&#32463;&#23433;&#35013;&#20102; PHP&#12290;<\/p>\n<p>&#32456;&#31471;&#25110;&#21629;&#20196;&#25552;&#31034;&#31526;&#35775;&#38382;&#12290;<\/p>\n<h2>&#27493;&#39588;&#24335;&#35299;&#20915;&#26041;&#26696;<\/h2>\n<h3>&#27493;&#39588;1&#65306;&#39564;&#35777;PHP&#23433;&#35013;<\/h3>\n<p>&#22312;&#36827;&#34892;&#25925;&#38556;&#25490;&#38500;&#20043;&#21069;&#65292;&#30830;&#20445;PHP&#24050;&#27491;&#30830;&#23433;&#35013;&#30340;&#27493;&#39588;&#22914;&#19979;&#65306;<\/p>\n<pre><code>php -v<\/code><\/pre>\n<p>&#36825;&#24212;&#35813;&#26174;&#31034;&#24403;&#21069;&#23433;&#35013;&#30340;PHP&#29256;&#26412;&#12290;&#22914;&#26524;&#26410;&#23433;&#35013;&#65292;&#30830;&#20445;&#22312;&#32487;&#32493;&#20043;&#21069;&#20026;&#24744;&#30340;&#24320;&#21457;&#29615;&#22659;&#23433;&#35013;&#36866;&#24403;&#30340;PHP&#29256;&#26412;&#12290;<\/p>\n<h3>&#27493;&#39588; 2&#65306;&#23450;&#20301;&#24744;&#30340; php.ini &#25991;&#20214;<\/h3>\n<p>php.ini &#25991;&#20214;&#26159;PHP&#30340;&#20027;&#35201;&#37197;&#32622;&#25991;&#20214;&#12290;&#35201;&#21551;&#29992; &#8216;fileinfo&#8217; &#25193;&#23637;&#65292;&#24744;&#38656;&#35201;&#22312;&#25805;&#20316;&#31995;&#32479;&#30340;&#29305;&#23450;&#21629;&#20196;&#34892;&#25191;&#34892;&#20197;&#19979;&#21629;&#20196;&#20043;&#19968;&#65306;<\/p>\n<pre><code>php --ini  # Unix\/Linux\/Macphp -i | findstr \/c:\"Loaded Configuration File\"  # Windows<\/code><\/pre>\n<p>&#35831;&#35760;&#24471;&#35760;&#19979;PHP.INI&#25991;&#20214;&#30340;&#36335;&#24452;&#65292;&#22240;&#20026;&#31245;&#21518;&#24744;&#38656;&#35201;&#23545;&#20854;&#36827;&#34892;&#32534;&#36753;&#12290;<\/p>\n<h3>&#31532;3&#27493;&#65306;&#21551;&#29992;&ldquo;fileinfo&rdquo;&#25193;&#23637;<\/h3>\n<p>&#35831;&#22312;&#25991;&#26412;&#32534;&#36753;&#22120;&#20013;&#20197;&#31649;&#29702;&#21592;&#26435;&#38480;&#25171;&#24320;php.ini&#25991;&#20214;&#12290;&#26597;&#25214;&#20197;&#19979;&#34892;&#65306;<\/p>\n<pre><code>;extension=fileinfo<\/code><\/pre>\n<p>&#22312;&#26576;&#20123;&#37197;&#32622;&#20013;&#65292;&#21487;&#33021;&#20250;&#32570;&#23569;&#34892;&#65292;&#25110;&#32773;&#25991;&#20214;&#20449;&#24687;&#21487;&#33021;&#27809;&#26377;&#20197;&#20998;&#21495;&#65288;;&#65289;&#31526;&#21495;&#36827;&#34892;&#27880;&#37322;&#35828;&#26126;&#12290;&#22914;&#26524;&#35813;&#34892;&#34987;&#29992;&#20998;&#21495;&#65288;;&#65289;&#36827;&#34892;&#20102;&#27880;&#37322;&#65292;&#37027;&#20040;&#38656;&#35201;&#31227;&#38500;&#20998;&#21495;&#26469;&#21551;&#29992;&#25193;&#23637;&#12290;&#22914;&#26524;&#32570;&#22833;&#20102;&#35813;&#34892;&#65292;&#35831;&#22312;&#20854;&#21518;&#30340;&#25193;&#23637;&#21015;&#34920;&#26411;&#23614;&#28155;&#21152;&#35813;&#34892;&#65292;&#19988;&#26080;&#38656;&#27880;&#37322;&#12290;&#24744;&#30340;&#34892;&#24212;&#22914;&#19979;&#25152;&#31034;&#65306;<\/p>\n<pre><code>extension=fileinfo<\/code><\/pre>\n<p>&#20445;&#23384;&#23545;php.ini&#25991;&#20214;&#30340;&#26356;&#25913;&#24182;&#20851;&#38381;&#32534;&#36753;&#22120;&#12290;<\/p>\n<h3>&#31532;4&#27493;&#65306;&#37325;&#21551;&#24744;&#30340;Web&#26381;&#21153;&#22120;<\/h3>\n<p>&#20026;&#20102;&#20351;&#26356;&#25913;&#29983;&#25928;&#65292;&#24744;&#38656;&#35201;&#37325;&#21551;&#24744;&#30340;Web&#26381;&#21153;&#22120;&#12290;&#35831;&#25191;&#34892;&#30456;&#24212;&#30340;&#21629;&#20196;&#20197;&#36866;&#24212;&#24744;&#30340;&#29615;&#22659;&#65306;<\/p>\n<pre><code>sudo service apache2 restart  # For Apache on Unix\/Linux\/Macsudo service nginx restart  # For Nginx on Unix\/Linux\/MacRestart-Service -Name   # For Windows, replace  with your web server's service name.<\/code><\/pre>\n<h3>&#27493;&#39588;5&#65306;&#30830;&#35748;&#20462;&#22797;<\/h3>\n<p>&#37325;&#21551;&#26381;&#21153;&#22120;&#21518;&#65292;&#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#20197;&#39564;&#35777;fileinfo&#25193;&#23637;&#26159;&#21542;&#24050;&#21551;&#29992;&#65306;<\/p>\n<pre><code>php -m | grep fileinfo<\/code><\/pre>\n<p>&#22914;&#26524;&ldquo;fileinfo&rdquo;&#25193;&#23637;&#34987;&#27491;&#30830;&#21551;&#29992;&#65292;&#23427;&#24212;&#35813;&#20986;&#29616;&#22312;&#36820;&#22238;&#30340;&#27169;&#22359;&#21015;&#34920;&#20013;&#12290;&#24744;&#36824;&#21487;&#20197;&#22312;PHP&#25991;&#20214;&#20013;&#20351;&#29992;&ldquo;phpinfo()&rdquo;&#20989;&#25968;&#24182;&#26597;&#30475;&#29983;&#25104;&#30340;&#32593;&#39029;&#20013;&#30340;&ldquo;fileinfo&rdquo;&#20197;&#30830;&#20445;&#35813;&#25193;&#23637;&#24050;&#21152;&#36733;&#12290;<\/p>\n<h3>&#35299;&#20915;&#20854;&#20182;&#38382;&#39064;&#12290;<\/h3>\n<p>&#22914;&#26524;&#20173;&#28982;&#36935;&#21040;&#38382;&#39064;&#65292;&#35831;&#32771;&#34385;&#39564;&#35777;&#24744;&#30340;PHP&#29256;&#26412;&#19982;Composer&#30340;&#20860;&#23481;&#24615;&#65292;&#26816;&#26597;&#26159;&#21542;&#30001;SELinux&#25110;&#20854;&#20182;&#23433;&#20840;&#23376;&#31995;&#32479;&#24178;&#25200;&#65292;&#29978;&#33267;&#23581;&#35797;&#23433;&#35013;&#19981;&#21516;&#30340;PHP&#29256;&#26412;&#12290;<\/p>\n<p>&#36890;&#36807;&#23548;&#33322;PHP&#25193;&#23637;&#21644;Composer&#65292;&#20320;&#21487;&#20197;&#20248;&#21270;&#24320;&#21457;&#29615;&#22659;&#24182;&#22686;&#24378;&#35299;&#20915;&#38382;&#39064;&#30340;&#33021;&#21147;&#65292;&#20174;&#32780;&#19987;&#27880;&#20110;&#32534;&#20889;&#39640;&#36136;&#37327;&#30340;&#20195;&#30721;&#12290;<\/p>\n<h2>&#32467;&#35770;&#12290;<\/h2>\n<p>&#25353;&#29031;&#19978;&#36848;&#27493;&#39588;&#23436;&#25104;&#20043;&#21518;&#65292;&#20320;&#24212;&#35813;&#24050;&#32463;&#25104;&#21151;&#35299;&#20915;&#20102;Composer&#20013;&#30340;&ldquo;PHP&#25193;&#23637;&lsquo;fileinfo&rsquo;&#32570;&#22833;&rdquo;&#38169;&#35823;&#12290;&#22914;&#26524;&#22312;&#25191;&#34892;&#36825;&#20123;&#27493;&#39588;&#21518;&#38382;&#39064;&#20173;&#28982;&#23384;&#22312;&#65292;&#35831;&#26816;&#26597;&#24744;&#20351;&#29992;&#30340;PHP&#29256;&#26412;&#26159;&#21542;&#19982;Composer&#26399;&#26395;&#30340;&#29256;&#26412;&#30456;&#31526;&#65292;&#24182;&#26597;&#38405;&#24744;&#30340;&#25176;&#31649;&#26381;&#21153;\/&#29615;&#22659;&#25991;&#26723;&#20197;&#20102;&#35299;&#24179;&#21488;&#19978;&#30340;&#20219;&#20309;&#29305;&#27530;&#24615;&#12290;<\/p>\n<p>&#35760;&#24471;&#22312;&#24320;&#21457;&#29615;&#22659;&#30340;&#37197;&#32622;&#19978;&#22810;&#21152;&#27880;&#24847;&#65292;&#36825;&#23545;&#20110;&#39034;&#30021;&#30340;&#24320;&#21457;&#27969;&#31243;&#33267;&#20851;&#37325;&#35201;&#12290;&#23613;&#31649;&#36825;&#20123;&#38169;&#35823;&#21487;&#33021;&#20250;&#35753;&#20154;&#24863;&#21040;&#27822;&#20007;&#65292;&#20294;&#23427;&#20204;&#25552;&#20379;&#20102;&#23398;&#20064;&#25105;&#20204;&#27599;&#22825;&#20351;&#29992;&#30340;&#31995;&#32479;&#30340;&#26426;&#20250;&#12290;<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#38382;&#39064; &#22914;&#26524;&#20320;&#26159;&#19968;&#21517;PHP&#24320;&#21457;&#20154;&#21592;&#65292;&#22312;&#20351;&#29992;Composer&#65288;PHP&#30340;&#038;..<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false},"tags":[],"my1js2nav":[38],"tuisongtax":[],"class_list":["post-474","my1js","type-my1js","status-publish","hentry","my1js2nav-jcyy"],"acf":{"qian_art_seotitle":"","qian_art_seotitle_source":{"label":"SEO\u6807\u9898","type":"text","formatted_value":""},"qian_art_seokws":"","qian_art_seokws_source":{"label":"SEO\u5173\u952e\u8bcd","type":"text","formatted_value":""},"qian_art_stzhong":"","qian_art_stzhong_source":{"label":"\u4e2d | \u77ed\u6807\u9898","type":"text","formatted_value":""}},"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js\/474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/types\/my1js"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/users\/1"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/media?parent=474"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tags?post=474"},{"taxonomy":"my1js2nav","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js2nav?post=474"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tuisongtax?post=474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}