13 lines
903 B
Markdown
13 lines
903 B
Markdown
---
|
||
title: Working With Databases
|
||
localeTitle: 使用数据库
|
||
---
|
||
## PHP可以使用哪些选项来连接数据库?
|
||
|
||
PHP可以连接到各种不同的数据库,包括MongoDB,MsSQL和MySQL。 PHP和MySQL都很受欢迎,并提供简单,免费和开源的网站 要创建并经常一起创建所有类型的网站。 PHP和MySQL都可以扩展以支持大量用户。
|
||
|
||
PHP甚至支持多种方式来处理与MySQL的连接,包括MySQLi Procedural, PHP数据对象(PDO)和MySQLi对象与现已弃用的MySQL Connect一起定位。 使用PHP,该语言的核心功能内置了许多功能,可以链接到 数据库简单易行。
|
||
|
||
Mysqli的一些例子是 -
|
||
|
||
connect(“localhost”,“root”,“”,“db name”)或die(“无效的用户或密码......无法连接”); ?> 这里我们连接到phpmyadmin结构上的数据库,没有密码和数据库名称-db\_name |