简体   繁体   中英

Using scandir() with Magento

For the home page of my Magento store, I am using a basic gallery script which scans a predefined directory using scandir() and outputs each filename to be displayed in the gallery.

Everything works ok on my local machine, but the script seems to ignore the scandir() and just proceeds as normal without any errors or warnings. If I replace the scandir() and input the filenames directly, the gallery script works fine.

What is going wrong here?

Hard to tell without seeing your code in context, but my guess if scandir is returning an empty array, probably because you're not passing it what you think you're passing it. Add some debugging to your calls to scandir

$path;
var_dump($path);

$results = scandir($path);
var_dump($results);

and you should have a better idea of whats going on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM