Home>Article>Backend Development> Open up the two channels of Ren and Du to realize the connection between mysql and php
If you want to cook a good dish, you must first have unusual cooking skills, and secondly, have fresh ingredients, and these fresh ingredients are lying in this database. How to open the door of this database, a master key It's enough, why need more?PDO
is this master key, which can open any database door.
Definition:
PDO
is the abbreviation ofPHP Data Object
, which represents PHP data object and is a pureObject-oriented
Database operation extensionimplemented in an object-oriented manner.
1. Although the PDO class provides many methods, the commonly used methods are as follows:
PDOStatementclass object (the latter performs data parsing operations)
2. PDO instantiation object
The instantiated object uses its construction method __construct(string $dsn, string $user, string $pass[, array $drivers]) to implementhost address
port number(the default port number 3306 can be omitted)
associative arrays, set using
constantsinside PDO. (This can be omitted)
3. Data type after PDO instantiates the object
Recommended:php tutorial,php video tutorial
The above is the detailed content of Open up the two channels of Ren and Du to realize the connection between mysql and php. For more information, please follow other related articles on the PHP Chinese website!