0

すべてのコーディングが正しいことがわかる限り、これをテーブル構造に正しく配置することはできませんが、何らかの理由で機能していません。

これが私のコードです:

<?php
    echo "<table class='array'>
        <tr><th>&nbsp;&nbsp; Employee &nbsp;&nbsp;&nbsp;</th>
        <th>In Que &nbsp;&nbsp;&nbsp;</th>
        <th>Incomplete &nbsp;&nbsp;&nbsp;</th>
        <th>Processed </th></tr>";
    $count_result=array();
    $path = "Users";
    $folders = @scandir("$path");
    if ($folders) {
        foreach ($folders as $item) {
            $count = 0;
            if ((substr($item, 0, 1) == '.') || (preg_match("/\.php$/", $item)))
                continue;
            if (is_dir($path . "/" . $item)) {
                $target_folders = @scandir($path . "/" . $item . "/uploaded/");   
                if ($target_folders) {
                    foreach ($target_folders as $target_item) { 
                        if ((substr($target_item, 0, 1) == '.') || is_dir("$path/$item/uploaded/$target_item"))
                            continue;
                        $count++;
                    }
                }
                $count_result[$item]=$count;
            }
             echo "<tr><td><div class='data'>" .$item."
                </div></td>";
             echo "<td><div class='data1'>" .$count."
                </div></td>";
        }
    }
?>

<?php
    $counta_result=array();
    $path = "Users";
    $foldersa = @scandir("$path");
    if ($foldersa) {
        foreach ($foldersa as $itema) {
            $counta = 0;
            if ((substr($itema, 0, 1) == '.') || (preg_match("/\.php$/", $itema)))
                continue;
            if (is_dir($path . "/" . $itema)) {
                $target_foldersa = @scandir($path . "/" . $itema . "/incomplete/");
                if ($target_foldersa) {
                    foreach ($target_foldersa as $target_itema) {
                        if ((substr($target_itema, 0, 1) == '.') || is_dir("$path/$itema/uploaded/$target_itema"))
                            continue;
                        $counta++;
                    }
                }
                $counta_result[$itema]=$counta;
            }
            echo "<td><div class='data2'>" .$counta."</div></td>";
        }
    } 
?>

<?php
    $countb_result=array();
    $path = "Users";
    $foldersb = @scandir("$path");
    if ($foldersb) {
        foreach ($foldersb as $itemb) {
            $countb = 0;
            if ((substr($itemb, 0, 1) == '.') || (preg_match("/\.php$/", $itemb)))
                continue;
            if (is_dir($path . "/" . $itemb)) {
                $target_foldersb = @scandir($path . "/" . $itemb . "/processed/");
                if ($target_foldersb) {
                    foreach ($target_foldersb as $target_itemb) {
                        if ((substr($target_itemb, 0, 1) == '.') || is_dir("$path/$itemb/processed/$target_itemb"))
                            continue;
                        $countb++;
                    }
                }
                $countb_result[$itemb]=$countb;
            }
            echo "<td><div class='data3'>" .$countb."</div></td></tr>";
        }
    } 
?>
</table>
4

2 に答える 2

1

1)実際の質問に対する答えは</tr>、最初の for ループにa がなく、 <tr>2 番目の for ループに開始点がないということです。したがって、これらのものが実際に欠けているか、ブラケットに何か問題があります。

2) コードの形式が適切でないため、これを見逃している可能性があります。必要のない HTML のブロックを「エコー」するのを避けると、IDE の構文の強調表示でこの間違いを見つけることができる場合があります (IDE によって異なります)。また、コードがかなりきれいになります。

于 2013-09-18T06:14:03.477 に答える