|
楼主 |
发表于 2010-11-24 10:37:03
|
显示全部楼层
用你的第一方法好用 我修改一下
$this->load->helper('file');
$content = read_file('./database.sql');
$content = preg_replace("/#(.*)\s#(.*)TABLE(.*)(.*)\s#/i","",$content);//去掉注释部分
$sqls = explode(";",$content);
foreach($sqls as $key=>$sql)
{
$sql = trim($sql);
if(!empty($sql))
{
$bool = $this->db->query($sql) or die(mysql_error());
}
}
谢谢jeongee |
|