سؤال

I am using this code to list all the files in a Dir:

<?php

if ($handle = opendir('CD300/')) {
   while (false !== ($file = readdir($handle)))
      {
          if ($file != "." && $file != ".."){
            $thelist .= '<a href="/CD300/'.$file.'" target="_blank" 

style="color: #0f33cc">'.$file.'</a></br>';
          }
       }

 closedir($handle);
  } 

echo "
<div id='output'>
List of help files:</div>
<div id='List'>
<?=$thelist


</div>"
?>

If I set the a href to have < li> tags then I get the list however the first result is not indented and the rest are. As I currently have it set, all of the files are displayed correctly however the first link is non clickable.

Am I missing something?

هل كانت مفيدة؟

المحلول

Remove the <?= markup, you are already printing the output from within PHP, so what happens is that <?= is literally appended in the first line just before you output the file list.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top