-4

我在执行代码期间遇到错误:

PHP 解析错误:语法错误,意外的 T_CONSTANT_ENCAPSED_STRING,期待 ',' 或 ';' 在 C:\apache2triad\htdocs\imagedisplay.php 第 28 行

<?php

$dir= "C:\apache2triad\htdocs\phppgadmin\images\phpimages";

$file_display= array('jpg', 'jpeg', 'png', 'gif');

if(file_exists($dir)== false) 
{
  echo "directory x not found";
}
else
{
  $dir_content= scandir($dir);

  foreach($dir_content as $file)
  {
    $file_type = strtolower(end(explode('.', $file)));
     
    // echo "$file <br> ";

    if($file !=='.' && $file !=='..')
    {
      //echo "$file <br> ";   
      echo "<img src="', $dir, '/', $file, '" alt="', $file, '"/>";
    }      
  }   
}
?>
4

1 回答 1

3
echo "<img src="', $dir, '/', $file, '" alt="', $file, '"/>";
               ^^-- here

你基本上有两个不同的字符串在这里背靠背,使这条线完全无效。

于 2012-05-20T14:14:42.780 回答