//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"; } ?>
时间: 2024-10-26 02:58:52
//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"; } ?>