-1
이 코드는 오류가없는 테이블을 생성해야합니다. 각 셀은 특정 디렉토리 안에 파일 유형을 표시합니다. 그러나 테이블을 인쇄하는 데 문제가 있습니다. 이 모양입니다. 당신이 0으로 설정 한 후PHP를 사용하여 테이블 생성
<table border="1">
<?php
function identifyFile($file) {
$file_pt = pathinfo($file);
$file_ex = $file_pt['extension'];
$images = array('jpeg','png','jpg','bmp');
$docs = array('doc','docx','pdf','txt');
$comp = array('rar','zip');
if (in_array($file_ex,$images)){
return "image";
}
elseif (in_array($file_ex,$docs)){
return "doc";
}
elseif (in_array($file_ex,$comp)){
return "compressed";
}
else {
return "unknown";
}
}
function svfilename($user_dir){
$loops = 0;
echo "<tr>";
foreach (glob("$user_dir*.*") as $filename) {
echo '<td>' .identifyFile($filename). '</td>';
if($loops == 2) {
echo "</tr>";
echo "<tr>";
$loops = 0;
}
++$loops;
}
echo "</tr>";
}
svfilename("jfetz/");
?>
</table>
? – m59$loops = -1;
에 내부에 쉽게 수정 변경$loops = 0;
를 들어당신의 코드는 어디에 있습니까?! – Pepe
코드를 넣는 것을 잊어 버렸습니다. – conquistador