In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Noun explanation: what on earth is mysqli,mysqlnd,pdo? Hey, what's the use?
MySQL: This extension is deprecated as of PHP 5.5.0, and has been removed as of php 7.0.0.
MYSQLI: mysql Improved Extension
MySQLND: MySQL Native Drive
PDO:The PHP Data Objects . Extension defines a lightweight, consistent interface for accessing databases in PHP .
The above is extracted from the official manual of PHP: http://php.net/manual/en/book.mysqli.php
The following is a Chinese translation:
MYSQL, also known as the Original MySQL,PHP4 version of the MYSQL extension, has been abandoned since PHP5 and removed from PHP7.
MYSQLI is called "MySQL enhanced extension".
MYSQLND MYSQL NATIVE DIRVER is called MYSQL "official driver" or, more directly, "Native driver".
PDO PHP Data Objects PHP data object is a database abstraction layer specification in PHP applications.
Add a few more nouns to explain:
1. What is API?
An application program interface (short for Application Programming Interface) that defines classes, methods, functions, variables, and all the things that need to be called in your application to accomplish a particular task. The API needed when the PHP application needs to interact with the database is usually exposed through the PHP extension (called to the terminal PHP programmer).
The MYSQL and MYSQLI extensions mentioned above provide such API.
2. What is a driver?
Driver is a piece of software code designed to interact with a specific type of database server. The driver may call some libraries
Such as MySQL client libraries or MySQL Native-driven libraries. These libraries implement the underlying protocols for interacting with the MySQL database server.
From the perspective of PHP extension, MYSQL and MYSQLi are still more upper-level extensions, relying on lower-level libraries to connect and access databases.
The MYSQLND mentioned above is the underlying database driver. Of course, there is also a driver called libmysqlclient.
Summary:
From an application perspective, we manipulate the database through the MYSQL of PHP or the API provided by the MYSQLi extension.
From a low-level point of view, MYSQLND provides support for underlying interaction with the database (which can be simply understood as network protocol interaction with MySQL server).
PDO, on the other hand, provides a unified API interface so that your PHP application does not care about the specific type of database server system to connect to. In other words, if you use PDO's API, you can seamlessly switch database servers whenever needed. For example, MYSQL,SQLITE, any database is fine.
In other words, from the point of view of most functions, the API interface provided by PDO and the interface provided by MYSQLI are the same for ordinary additions, deletions, modifications and queries.
Understand through PHP code:
MYSQL connection:
PDO connection:
Pay attention to common parameters
-- enable-pdo
-- with-pdo-mysql
-- enable-mysqlnd
-- with-mysqli
With-mysql / / php7 is no longer supported. No matter it is compiled or installed by yum, it will be reported to ERROR.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.