如果数据库为 sqlserver ,需要开启账号的登录权限和数据库的操作权限
// 连接$server='127.0.0.1,7001';$userid='sw_device';$pw='root';$dbname='sw_device_data';$constring='odbc:driver={SQL Server};Server='.$server.';Database='.$dbname.';';$db= new PDO($constring,$userid,$pw);// 查询function get_table_arr($sql){// global $db;$result=db_query($sql);$list=[];while ($re = $result->fetch()) {$list[]=$re;}return $list;}// 执行语句function db_query($sql){global $db;return $db->query($sql);}
正在学习Go语言的PHP程序员。