导出数组时候这么定义
new array
("<img src='.$file."'>")你忘了在图片名称前加<img src=filename>了

解决方案 »

  1.   

    我记起一件事来了,php有个工作目录,用getcwd可以得到你的工作目录。如果c:/apache/apache/$aaa" 不是你网站的虚拟目录那么你读到的文件
    将会使单个文件,如a.gif,b.gif, 而不是 c:/apache/apache/$aaa/a.gif,***每个文件名称前加上getcwd().$file我做数据备份的时候就碰到这种问题,数据备份文件夹不是工作目录
      

  2.   

    <?
    //right now $curdir is the current directory
    $curdir = getcwd();
    $inputarray = opendir($curdir);
    $resultarray = array();
    while($var = readdir($inputarray))
    {
    //this checks that the var listed is a directory
    //but skips . and ..
     if(is_dir($curdir . "/" . $var))
     {
       if($var != '.' && $var != '..')
         $resultarray[]=$curdir . "/" . $var;
     }
    }
    for($x = 0; $x < sizeof($resultarray); $x++)
    {
    //instead of just echoing to the screen
    //you could put code here to do something
    //to each directory like chown or mv
     echo $resultarray[$x] . "\n";;
    }
    ?>
      

  3.   

    各位大哥:帮我看看下边的代码,如何在按任意键后,做图片变换??<?
    if($handle = opendir("c:/apache/apache/$aaa")) {
      while ($file = readdir($handle)) { 
       $files[] = $file;
      }
    }
    $i=0;
    echo "<script>\nvar files = new Array(\n";
    foreach($files as $value)
      if($value!="." && $value!="..") {
        if($i>0)
          echo ",";
        echo '"'.$value.'"';
        $i++;
      }
    echo ");\nvar files_con = 1;\n</script>\n";
    ?><div id="view"><script>
    function od(){
    if(this.clientWidth/document.body.clientWidth>this.clientHeight/document.body.clientHeight){this.width=(document.body.clientWidth-document.body.leftMargin*2)}else{this.height=(document.body.clientHeight-document.body.topMargin*2-4)}
    }
    document.write('<img src="'+files[files_con]+'"onload=od()>');</script>
    </div>
    <script for=document event=onkeypress language=javascript>
    if(files_con < files.length) {
      view.innerHTML += files[files_con]+"<br>";
      files_con++;
    }
    </script>