导出数组时候这么定义
new array
("<img src='.$file."'>")你忘了在图片名称前加<img src=filename>了
new array
("<img src='.$file."'>")你忘了在图片名称前加<img src=filename>了
解决方案 »
- php单页采集数据问题
- 求 php 代码的站内信 源代码
- php内容发布,附件异步上传,如何建立关系?
- 菜鸟想问:jsp中实现可定位可编辑的下拉列表
- 一个获得前一个sql插入循环的id(auto_increment)
- php socket编程 读完成后写阻塞
- 自己编写自定义函数对数据库进行充值操作,无果,求教
- 问一个关于文件操作的简单问题...
- 出现错误 Parse error: parse error, unexpected T_PUBLIC
- $_SESSION[property]=$pro;如果$pro是空值,$_SESSION[property]还会不会被注册?
- 如何用16进制表示UTF8码????
- 怎么得到客户机的操作系统是繁体操作系统还是简体操作系统?
将会使单个文件,如a.gif,b.gif, 而不是 c:/apache/apache/$aaa/a.gif,***每个文件名称前加上getcwd().$file我做数据备份的时候就碰到这种问题,数据备份文件夹不是工作目录
//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";;
}
?>
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>