连接数据库<?php $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } else { echo "ok!"; } // some code mysql_close($con); ?>