Вопрос по php, html, arrays – Массив в неупорядоченный список

6

Error: User Rate Limit Exceeded

    <?php
            $files = scandir($dir);
            //remove "." and ".."
            print_r($files);
    ?>

    <ul>
        <?php foreach($files as $file): ?>
            <li><?= $file ?></li>
        <?php endforeach; ?>
    </ul>

Error: User Rate Limit Exceeded<li>Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

.
.
.

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded think123
Error: User Rate Limit Exceededprint_r($files);Error: User Rate Limit Exceeded$dirError: User Rate Limit Exceeded$dirsError: User Rate Limit Exceeded think123
Error: User Rate Limit Exceeded Code Bunny
Error: User Rate Limit Exceeded Code Bunny
Error: User Rate Limit Exceeded think123

Ваш Ответ

5   ответов
5

    <li><?php echo $file ?></li>
<?php endforeach; ?>

OR


    <li><? echo $file ?></li>
<?php endforeach; ?>
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded Code Bunny
Error: User Rate Limit Exceeded
4

<?php
  $files = scandir($dir);
  //remove "." and ".."
  print_r($files);
?>

<ul>
  <?php foreach($files as $file) { ?>
  <li><?php echo $file; ?></li>
  <?php } ?>
</ul>

$dir<? ?><?=$var ?>

EDIT:

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded Code Bunny
Error: User Rate Limit Exceeded Code Bunny
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
6

function array2ul($array) {
    $out = "<ul>";
    foreach($array as $key => $elem){
        if(!is_array($elem)){
            $out .= "<li><span>" . $key . ": " . $elem . "</span></li>";
        } else {
            $out .= "<li><span>" . $key . "</span>" . array2ul($elem) . "</li>";
        }
    }
    $out .= "</ul>";
    return $out; 
}
Error: User Rate Limit Exceeded Code Bunny
Error: User Rate Limit Exceededsprintf()Error: User Rate Limit Exceeded$out .= "...";Error: User Rate Limit ExceededifError: User Rate Limit ExceededelseError: User Rate Limit Exceeded
1

if ( !empty($files) ) echo '<li>' . implode('<li>', $files);
Error: User Rate Limit Exceeded Code Bunny
3

<?= $file ?><?php echo $file ?>

Похожие вопросы