<form action="" method="post"> <input type="file" value="" name="file" size="20"> <input type="submit" value="check"> </form> <?<span>php </span><span>header</span>("Content-type:text/html;charse=utf8"<span>); </span><span>if</span>(<span>isset</span>(<span>$_POST</span>['file'<span>])){ </span><span>$pic</span> = <span>$_POST</span>['file'<span>]; </span><span>$pics</span> = <span>explode</span>(".", <span>$pic</span><span>); </span><span>echo</span> "上传文件的扩展名为:".<span>$pics</span>[<span>count</span>(<span>$pics</span>)-1<span>]; } </span>?>
以上就介紹了php使用post方式取得檔案副檔名,包括了方面的內容,希望對PHP教學有興趣的朋友有幫助。