不用引入文件,直接用。
<?php$mysql = new SaeMysql()
$sql = "SELECT * FROM `user` LIMIT 10"
$data = $mysql->getData( $sql )
$name = strip_tags( $_REQUEST['name'] )
$age = intval( $_REQUEST['age'] )
$sql = "INSERT INTO `user` ( `name` , `age` , `regtime` ) VALUES ( '" . $mysql->escape( $name ) . "' , '" . intval( $age ) . "' , NOW() ) "
$mysql->runSql( $sql )
if( $mysql->errno() != 0 )
{
die( "Error:" . $mysql->errmsg() )
}
$mysql->closeDb()
?>
php和sql实现成绩查询主要是通过curl模拟用户登录实现,不知道题主想要实现查询什么成绩,这里有四六级的代码供题主参考
//author http://blog.dxjsw.com//参数分别为准考证号,和姓名
function siliuji_tab($zkzh,$xm){
$xm=substr(urlencode($xm),0,27)
$url = "http://www.chsi.com.cn/cet/query?zkzh=".$zkzh."&xm=".$xm
$refer="http://www.chsi.com.cn/cet/"
$cookie_file = tempnam('./temp','cookie')
$ip = '127.0.0.1'
$headers['CLIENT-IP'] = $ip
$headers['X-FORWARDED-FOR'] = $ip
$headerArr = array()
foreach ( $headers as $n => $v )
{
$headerArr[] = $n . ':' . $v
}
$ch = curl_init($url)
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36")
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArr)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) // 获取数据返回
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true) // 在启用
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file)
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file)
curl_setopt($ch, CURLOPT_HEADER, 1)
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1)
curl_setopt($ch, CURLOPT_REFERER, $refer)
$result = curl_exec($ch)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)