Help - why it doesn't work?

MyHenry

新手上路
注册
2002-11-08
消息
166
荣誉分数
2
声望点数
0
I am trying to read all file names in a directory into an array. I run it (showPhoto.php) on server side. There was no error, no anything. I tried to insert a few "echo". All "echo" did not run...What's wrong with it? I am confused. Please help!
--------------

<?php
$aImages = array ( );
$dirpath = "Image/";
$iNumber = 0;
$diraccess = opendir($dirpath);
while ( false != ($filename = readdir($diraccess)) )
{
if( ($filename != ".") && ($filename != "..") )
{
$iNumber ++;
$aImages[$iNumber] = $filename;
echo "try2 <br>";
}
}
closedir($diraccess);
echo "try3 <br>";
?>
 
What server are you using? I am not familar with PHP. But if you are using LINUX or UNIX type servers, please check the access permission of the directory. Looks like you have a permission problem. You can use "ls -l" command to list the directory and file attributes. And using "chmod" to change the directory permission attributes.
 
Thanks for your reply. It does not seem to be the permission problem. Other PHP files run perfectly fine. But I will check again.

What server are you using? I am not familar with PHP. But if you are using LINUX or UNIX type servers, please check the access permission of the directory. Looks like you have a permission problem. You can use "ls -l" command to list the directory and file attributes. And using "chmod" to change the directory permission attributes.
 
the code work for me
I got:
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try3
 
It works now. I accidentally saved it in UNICODE format...Thanks for your reply.

the code work for me
I got:
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try2
try3
 
后退
顶部