21,887
社区成员
发帖
与我相关
我的任务
分享
$sqla = $pdo->prepare("SELECT * FROM `section` order by id");
$sqla->execute();
while ($rowa = $sqla->fetch()) {
$sid=$rowa["id"];
$section=$rowa["section"];
$sql = $pdo->prepare("SELECT * FROM `words` where sid='$sid'");
$sql->execute();
while ($row = $sql->fetch()) {
echo $sid."is";
print_r($row);
echo "<br/>";
echo $json=json_encode($row,JSON_UNESCAPED_UNICODE);
$myfile = fopen("../cache/".iconv("utf-8","gb2312",$section).".php", "a+") or die("Unable to open file!"); //w 重写 a追加
fwrite($myfile, $json);
fclose($myfile);
}
}
$sqla = $pdo->prepare("SELECT * FROM `section` order by id asc");
$sqla->execute();
while ($rowa = $sqla->fetch()) {
$sid=$rowa["id"];
$section=$rowa["section"];
$arr = array();
$i=0;
$sql = $pdo->prepare("SELECT * FROM `words` where sid='$sid'");
$sql->execute();
while($rowb = $sql->fetch()){
$arr[] = $rowb;
}
$json=json_encode($arr,JSON_UNESCAPED_UNICODE);
$myfile = fopen("../cache/".iconv("utf-8","gb2312",$section).".php", "a+") or die("Unable to open file!"); //w 重写 a追加
fwrite($myfile, $json);
fclose($myfile);
$i++;
}
$sqla = $pdo->prepare("SELECT * FROM `section` order by id asc");
$sqla->execute();
while ($rowa = $sqla->fetch()) {
$sid=$rowa["id"];
$section=$rowa["section"];
$i=0;
$sql = $pdo->prepare("SELECT * FROM `words` where sid='$sid'");
$sql->execute();
$row = $sql->fetch();
$arr[] = $row;
$json=json_encode($arr,JSON_UNESCAPED_UNICODE);
$myfile = fopen("../cache/".iconv("utf-8","gb2312",$section).".php", "a+") or die("Unable to open file!"); //w 重写 a追加
fwrite($myfile, $json);
fclose($myfile);
$i++;
}