当前位置:Gxlcms > 数据库问题 > mysql通过PDO扩展进行数据库连接的方法

mysql通过PDO扩展进行数据库连接的方法

时间:2021-07-01 10:21:17 帮助过:2人阅读

//PHP通过PDO方式连接到mysql

<?php 
$dsn="mysql:dbname=test;host=localhost";
$user="root";
$pass="";
$link=new PDO($dsn,$user,$pass);
if($link){
    echo "connect success with PDO";
}else{
    echo "can‘t connect mysql";
    }
?>


mysql通过PDO扩展进行数据库连接的方法

标签:

人气教程排行