一段PHP代码结果有关问题
程序员文章站
2022-06-13 17:55:23
...
一段PHP代码结果问题
结果:
nz01.pdf Array ( [0] => nz01.pdf ) nz02.pdf Array ( [0] => nz02.pdf ) nz03.pdf Array ( [0] => nz03.pdf ) nz04.pdf Array ( [0] => nz04.pdf ) nz05.pdf Array ( [0] => nz05.pdf ) nz06.pdf Array ( [0] => nz06.pdf ) nz07.pdf Array ( [0] => nz07.pdf ) nz08.pdf Array ( [0] => nz08.pdf ) nz09.pdf Array ( [0] => nz09.pdf ) nz10.pdf Array ( [0] => nz10.pdf ) nz11.pdf Array ( [0] => nz11.pdf ) nz12.pdf Array ( [0] => nz12.pdf ) nz13.pdf Array ( [0] => nz13.pdf ) nz14.pdf Array ( [0] => nz14.pdf ) nz15.pdf Array ( [0] => nz15.pdf ) nz16.pdf Array ( [0] => nz16.pdf ) nz17.pdf Array ( [0] => nz17.pdf ) nz18.pdf Array ( [0] => nz18.pdf ) nz19.pdf Array ( [0] => nz19.pdf ) nz20.pdf Array ( [0] => nz20.pdf ) nz21.pdf Array ( [0] => nz21.pdf ) nz22.pdf Array ( [0] => nz22.pdf ) nz23.pdf Array ( [0] => nz23.pdf ) nz24.pdf Array ( [0] => nz24.pdf ) nz25.pdf Array ( [0] => nz25.pdf ) nz26.pdf Array ( [0] => nz26.pdf ) nz27.pdf Array ( [0] => nz27.pdf ) nz28.pdf Array ( [0] => nz28.pdf ) nz29.pdf Array ( [0] => nz29.pdf ) nz30.pdf Array ( [0] => nz30.pdf ) nz31.pdf Array ( [0] => nz31.pdf ) nz32.pdf Array ( [0] => nz32.pdf ) nz33.pdf Array ( [0] => nz33.pdf ) nz34.pdf Array ( [0] => nz34.pdf ) nz35.pdf Array ( [0] => nz35.pdf ) nz36.pdf Array ( [0] => nz36.pdf ) nz37.pdf Array ( [0] => nz37.pdf ) nz38.pdf Array ( [0] => nz38.pdf ) nz39.pdf Array ( [0] => nz39.pdf ) nz40.pdf Array ( [0] => nz40.pdf ) nz41.pdf Array ( [0] => nz41.pdf ) nz42.pdf Array ( [0] => nz42.pdf ) nz43.pdf Array ( [0] => nz43.pdf ) nz44.pdf Array ( [0] => nz44.pdf ) nz45.pdf Array ( [0] => nz45.pdf ) nz46.pdf Array ( [0] => nz46.pdf ) nz47.pdf Array ( [0] => nz47.pdf ) nz48.pdf Array ( [0] => nz48.pdf ) nz49.pdf Array ( [0] => nz49.pdf ) nz50.pdf Array ( [0] => nz50.pdf ) nz51.pdf Array ( [0] => nz51.pdf ) nz52.pdf Array ( [0] => nz52.pdf ) nz53.pdf Array ( [0] => nz53.pdf ) nz54.pdf Array ( [0] => nz54.pdf ) nz55.pdf Array ( [0] => nz55.pdf ) nz56.pdf Array ( [0] => nz56.pdf ) nz57.pdf Array ( [0] => nz57.pdf ) nz58.pdf Array ( [0] => nz58.pdf ) nz59.pdf Array ( [0] => nz59.pdf ) nz60.pdf Array ( [0] => nz60.pdf )
我只是想把目录里的文件名都分条存入数据库呀。这样存不进去.
------解决方案--------------------
呵呵,看错眼啦
$sql = "insert into pdfcontents (pdf_title) value ('{$arr}')";
$arr是explode的数组吧,不带这样执行的,,你希望保存什么吧
- PHP code
文件名:",$file,"
"; listDir($dir."/".$file."/"); } else{ if($file!="."&&$file!=".."){ echo $file." "; $arr = explode(" ",$file); print_r($arr); $sql = "insert into pdfcontents (pdf_title) value ('{$arr}')"; } } } closedir($dh); } } return ($file); } listDir("C:/AEED/PHPnow/htdocs/2003Z/nz/"); ?>
结果:
nz01.pdf Array ( [0] => nz01.pdf ) nz02.pdf Array ( [0] => nz02.pdf ) nz03.pdf Array ( [0] => nz03.pdf ) nz04.pdf Array ( [0] => nz04.pdf ) nz05.pdf Array ( [0] => nz05.pdf ) nz06.pdf Array ( [0] => nz06.pdf ) nz07.pdf Array ( [0] => nz07.pdf ) nz08.pdf Array ( [0] => nz08.pdf ) nz09.pdf Array ( [0] => nz09.pdf ) nz10.pdf Array ( [0] => nz10.pdf ) nz11.pdf Array ( [0] => nz11.pdf ) nz12.pdf Array ( [0] => nz12.pdf ) nz13.pdf Array ( [0] => nz13.pdf ) nz14.pdf Array ( [0] => nz14.pdf ) nz15.pdf Array ( [0] => nz15.pdf ) nz16.pdf Array ( [0] => nz16.pdf ) nz17.pdf Array ( [0] => nz17.pdf ) nz18.pdf Array ( [0] => nz18.pdf ) nz19.pdf Array ( [0] => nz19.pdf ) nz20.pdf Array ( [0] => nz20.pdf ) nz21.pdf Array ( [0] => nz21.pdf ) nz22.pdf Array ( [0] => nz22.pdf ) nz23.pdf Array ( [0] => nz23.pdf ) nz24.pdf Array ( [0] => nz24.pdf ) nz25.pdf Array ( [0] => nz25.pdf ) nz26.pdf Array ( [0] => nz26.pdf ) nz27.pdf Array ( [0] => nz27.pdf ) nz28.pdf Array ( [0] => nz28.pdf ) nz29.pdf Array ( [0] => nz29.pdf ) nz30.pdf Array ( [0] => nz30.pdf ) nz31.pdf Array ( [0] => nz31.pdf ) nz32.pdf Array ( [0] => nz32.pdf ) nz33.pdf Array ( [0] => nz33.pdf ) nz34.pdf Array ( [0] => nz34.pdf ) nz35.pdf Array ( [0] => nz35.pdf ) nz36.pdf Array ( [0] => nz36.pdf ) nz37.pdf Array ( [0] => nz37.pdf ) nz38.pdf Array ( [0] => nz38.pdf ) nz39.pdf Array ( [0] => nz39.pdf ) nz40.pdf Array ( [0] => nz40.pdf ) nz41.pdf Array ( [0] => nz41.pdf ) nz42.pdf Array ( [0] => nz42.pdf ) nz43.pdf Array ( [0] => nz43.pdf ) nz44.pdf Array ( [0] => nz44.pdf ) nz45.pdf Array ( [0] => nz45.pdf ) nz46.pdf Array ( [0] => nz46.pdf ) nz47.pdf Array ( [0] => nz47.pdf ) nz48.pdf Array ( [0] => nz48.pdf ) nz49.pdf Array ( [0] => nz49.pdf ) nz50.pdf Array ( [0] => nz50.pdf ) nz51.pdf Array ( [0] => nz51.pdf ) nz52.pdf Array ( [0] => nz52.pdf ) nz53.pdf Array ( [0] => nz53.pdf ) nz54.pdf Array ( [0] => nz54.pdf ) nz55.pdf Array ( [0] => nz55.pdf ) nz56.pdf Array ( [0] => nz56.pdf ) nz57.pdf Array ( [0] => nz57.pdf ) nz58.pdf Array ( [0] => nz58.pdf ) nz59.pdf Array ( [0] => nz59.pdf ) nz60.pdf Array ( [0] => nz60.pdf )
我只是想把目录里的文件名都分条存入数据库呀。这样存不进去.
------解决方案--------------------
呵呵,看错眼啦
$sql = "insert into pdfcontents (pdf_title) value ('{$arr}')";
$arr是explode的数组吧,不带这样执行的,,你希望保存什么吧
相关文章
相关视频