mr.spray
Member
خیلی تازه کارم ها!!
این کد برنامه ای است که عکس های داخل یک دایرکتوری رو به صورت کوچک برای ما لیست می کنه.
خط 16 اون که همون حلقه while هست رو مشکل می گیره،نمی دونم چیکار کنم،توی یه مرجع هم نگاه کردم درست بود.
Parse error: parse error in C:\wamp\www\123.php on line 16
لطفا کمک کنید.
من از WampServer استفاده می کنم.
این کد برنامه ای است که عکس های داخل یک دایرکتوری رو به صورت کوچک برای ما لیست می کنه.
خط 16 اون که همون حلقه while هست رو مشکل می گیره،نمی دونم چیکار کنم،توی یه مرجع هم نگاه کردم درست بود.
Parse error: parse error in C:\wamp\www\123.php on line 16
لطفا کمک کنید.
من از WampServer استفاده می کنم.
کد:
[LTR]<html>
<head>
<title>imageIndex</title>
</head>
<body>
<?php
// image index
// generates an index file containing all images in a particular directory
//point to whatever directory you wish to index.
//index will be written to this directory as imageIndex.html
$dirName = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures";
$dp = opendir($dirName);
chdir($dirName);
//add all files in directory to $theFiles array
$currentFile[COLOR="Red"]
while ($currentFile !== false){
$currentFile = readDir($dp);
$theFiles[] = $currentFile;
} // end while[/COLOR]
//extract gif and jpg images
$imageFiles = preg_grep("/jpg$|gif$/", $theFiles);
$output = "";
foreach ($imageFiles as $currentFile){
$output .= <<<HERE
<a href = $currentFile>
<img src = "$currentFile"
height = 50
width = 50>
</a>
HERE;
} // end foreach
//save the index to the local file system
$fp = fopen("imageIndex.html", "w");
fputs ($fp, $output);
fclose($fp);
//readFile("imageIndex.html");
print "<a href = $dirName/imageIndex.html>image index</a>\n";
?>
</body>
</html>
[/LTR]