Home>Article>Backend Development> Two ways to connect to myql database in php
php
In the actual development process, it is often necessary to connect to the database. With the update of thephp
version, two methods of connecting to themysql
database are currently enabled by default. There is nothing better thanmysqli
andpdo
. This article will take you to take a look.
1.pdo connects to the database
"; ?>
输出:连接成功
2.mysqli connects to the database
";
输出:连接成功
Recommended:《2021 PHP interview questions summary (collection)》《php video tutorial》
The above is the detailed content of Two ways to connect to myql database in php. For more information, please follow other related articles on the PHP Chinese website!