Blogger Information
Blog 30
fans 0
comment 0
visits 23456
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PDO之数据库操作
深海巨兽皮皮虾的博客
Original
665 people have browsed it

    PDO相对于MySQL链接方式比较:

    PDO可直接链接多种数据库   -- MySQL只针对MySQL

    链接数据库:

try{
    $dsn = "mysql:host=localhost;dbname=demo;charset=utf8";
    $user = "root";
    $password = "root";
    $pdo = new PDO($dsn,$user,$password);
}catch(PDOException $e){
    print "Connect error:".$e->getMessage();
}
//最简写法:
    $pdo = new PDO("mysql:dbname=数据库名",root,root);


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post