<?php $db = new PDO('sqlite:test.sqlite'); if ($db){ echo 'OK!SQLite 连接成功!<br />'; }else{ echo 'Error!SQLite 连接失败,请检查!<br />'; } echo "<br />查询输出:<br />"; $db->exec("INSERT INTO news (id,title,date) VALUES ( '2', 'MySQL', '".date('Y-m-d H:i:s')."')"); foreach ($db->query('SELECT id,title,date FROM news;') as $row) { echo $row[0].' / '.$row[1].' / '.$row[2].'<br />'; } ?>