第一段PHP代码结果问题
PHPコード
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
<?php
$DBserver = "localhost";
$DBname = "lookdb";
$DBuser = "root";
$DBpassword = "";
$con = mysql_connect("localhost","root","");
mysql_select_db("lookdb");
function listDir($dir){
if (is_dir($dir)){
if($dh = opendir($dir)){
while(($file = readdir($dh))!== false){
if((is_dir($dir."/".$file))&&$file!="."&&$file!=".."){
echo "<b><font color='red'>文件名:</font></b>",$file,"<br><hr>";
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 配列 ( [0] => nz02.pdf ) nz03.pdf 配列 ( [0] => nz03.pdf ) nz04.pdf 配列 ( [0] => nz04.pdf ) nz05.pdf 配列 ( [0] ] => nz05.pdf ) nz06.pdf 配列 ( [0] => nz06.pdf ) nz07.pdf 配列 ( [0] => nz07.pdf ) nz08.pdf 配列 ( [0] => nz08 .pdf ) nz09.pdf 配列 ( [0] => nz09.pdf ) nz10.pdf 配列 ( [0] => nz10.pdf ) nz11.pdf 配列 ( [0] => nz11.pdf ) nz12。 pdf 配列 ( [0] => nz12.pdf ) nz13.pdf 配列 ( [0] => nz13.pdf ) nz14.pdf 配列 ( [0] => nz14.pdf ) nz15.pdf 配列 ( [0] ] => nz15.pdf ) nz16.pdf 配列 ( [0] => nz16.pdf ) nz17.pdf 配列 ( [0] => nz17.pdf ) nz18.pdf 配列 ( [0] => nz18 .pdf ) nz19.pdf 配列 ( [0] => nz19.pdf ) nz20.pdf 配列 ( [0] => nz20.pdf ) nz21.pdf 配列 ( [0] => nz21.pdf ) nz22。 pdf 配列 ( [0] => nz22.pdf ) nz23.pdf 配列 ( [0] => nz23.pdf ) nz24.pdf 配列 ( [0] => nz24.pdf ) nz25.pdf 配列 ( [0] ] => nz25.pdf ) nz26.pdf 配列 ( [0] => nz26.pdf ) nz27.pdf 配列 ( [0] => nz27.pdf ) nz28.pdf 配列 ( [0] => nz28.pdf ) nz29.pdf 配列 ( [0] => nz29.pdf ) nz30 .pdf 配列 ( [0] => nz30.pdf ) nz31.pdf 配列 ( [0] => nz31.pdf ) nz32.pdf 配列 ( [0] => nz32.pdf ) nz33.pdf 配列 ( [ 0] => nz33.pdf ) nz34.pdf 配列 ( [0] => nz34.pdf ) nz35.pdf 配列 ( [0] => nz35.pdf ) nz36.pdf 配列 ( [0] => nz36.pdf ) nz37.pdf 配列 ( [0] => nz37.pdf ) nz38.pdf 配列 ( [0] => nz38.pdf ) nz39.pdf 配列 ( [0] => nz39.pdf ) nz40 .pdf 配列 ( [0] => nz40.pdf ) nz41.pdf 配列 ( [0] => nz41.pdf ) nz42.pdf 配列 ( [0] => nz42.pdf ) nz43.pdf 配列 ( [ 0] => nz43.pdf ) nz44.pdf 配列 ( [0] => nz44.pdf ) nz45.pdf 配列 ( [0] => nz45.pdf ) nz46.pdf 配列 ( [0] => nz46.pdf ) nz47.pdf 配列 ( [0] => nz47.pdf ) nz48.pdf 配列 ( [0] => nz48.pdf ) nz49.pdf 配列 ( [0] => nz49.pdf ) nz50 .pdf 配列 ( [0] => nz50.pdf ) nz51.pdf 配列 ( [0] => nz51.pdf ) nz52.pdf 配列 ( [0] => nz52.pdf ) nz53.pdf 配列 ( [ 0] => nz53.pdf ) nz54.pdf 配列 ( [0] => nz54.pdf ) nz55.pdf 配列 ( [0] => nz55.pdf ) nz56.pdf 配列 ( [0] => nz56.pdf ) nz57 .pdf 配列 ( [0] => nz57.pdf ) nz58.pdf 配列 ( [0] => nz58.pdf ) nz59.pdf 配列 ( [0] => nz59.pdf ) nz60.pdf 配列 ( [ 0] => nz60.pdf )
我只是想录里的文件名都存入力据库呀。この样存不去。
---- --解決案--------------------
呵呵,看错眼啦
$sql = "pdfcontents (pdf_title) 値 ('{$arr}') に挿入";
$arr は爆発する数组吧,不带这样実行的、、保存希望物么吧