<?php function into($constr) { $con = mysql_connect("localhost","root","root"); if (!$con) { die(‘Could not connect: ‘ . mysql_error()); } mysql_select_db("sa", $con); mysql_query($constr); mysql_close($con); } //调用实例 $str="INSERT INTO doc (doc_num,doc_name,doc_from,doc_time) VALUES (‘2014-3‘,‘a test name‘,‘‘,‘2014/9/25‘)"; into($str); ?>