一、脚本如下
<?php
$t1 = microtime(true);
$con = mysql_connect('ip:port','user','passwd');
mysql_select_db('lottery',$con);
if($con){
$result = mysql_query('select * from dbname where dbname_id=609911958',$con);
$row = mysql_fetch_row($result);
}else{
echo "connect error\n";
}
$t2 = microtime(true);
if($t2-$t1 > 1){
echo $t1."-".$t2."-time out\n";
}else{
echo '.';
}
exit;
二、配合shell调用
for i in `seq 1 20000`;do echo $i;php ./testmysql4.php;done