I'm not sure about this, but it might work:
<?php $files = scandir($dir); <ul> <?php foreach($files as $file) { ?> <li><?php echo $file; ?></li> <?php } ?> </ul>
What would I use, and if that doesn't work, perhaps because your $dir
variable contains nothing (has an error). One of the reasons why your source code may not have worked because I donβt think the <? ?>
tags are <? ?>
<? ?>
compatible on each server. Also, from what I know in php there is no thing <?=$var ?>
. I thought it exists only in ASP, etc.
EDIT: In response to your question about the inferiority of curly braces, they are a generally accepted standard in PHP. It could be different in C / C ++ / C # Family, I don't know.
source share