PHP版本5.2.*
PHP versione 5.2.*
我的功能不起作用:/
服务器中的图像,在以下文件夹中:/public_html/gallery/images
images in server, in folder: /public_html/gallery/images
<?php foreach(glob('gallery/images/*', GLOB_NOSORT) as $image) { echo "Filename: " . $image . "<br />"; } ?>
有什么帮助吗?我在做什么错?
any help? what im doing wrong?
我得到的错误是:警告:在第2行的/home/a9773555/public_html/gallery/index.php中为foreach()提供了无效的参数
error i get is : Warning: Invalid argument supplied for foreach() in /home/a9773555/public_html/gallery/index.php on line 2
推荐答案问题似乎是您已将php文件放在gallery文件夹中.
The problem looks you have put your php file in gallery folder...
/home/a9773555/public_html/gallery/index.php
/home/a9773555/public_html/gallery/index.php on line 2
如果是这种情况(如果您将index.php放在图库中),请尝试以下操作:
if that is the case (if you put index.php in gallery) then try the following:
<?php foreach(glob('images/*', GLOB_NOSORT) as $image) { echo "Filename: " . $image . "<br />"; } ?>或执行以下操作,
将index.php放在/home文件夹中.然后...
Put your index.php in your /home folder. then...
<?php foreach(glob('a9773555/public_html/gallery/images/*', GLOB_NOSORT) as $image) { echo "Filename: " . $image . "<br />"; } ?>尝试一下.让我知道...
Give it a try. and let me know...
更多推荐
php foreach和glob()函数
发布评论