Home  >  Article  >  Backend Development  >  PHP development framework Yii Framework tutorial (23) Database-overview

PHP development framework Yii Framework tutorial (23) Database-overview

黄舟
黄舟Original
2017-01-22 09:15:511103browse

Yii provides powerful database programming support.

Yii Data Access Object (DAO) is built on the PHP Data Object (PDO) extension, allowing access to different database management systems (DBMS) through a single unified interface. Applications developed using Yii's DAO can easily switch to different database management systems without modifying the data access code.

Yii's Active Record (AR) implements the widely used object-relational mapping (ORM) method to further simplify database programming. By convention, a class represents a table and an instance represents a row of data. Yii AR eliminates most of the repetitive tasks of SQL statements used to handle CRUD (create, read, update and delete) data operations.

Although Yii's DAO and AR can handle almost all database-related tasks, you can still use your own database library in your Yii application. In fact, the Yii framework is carefully designed to be used simultaneously with other third-party libraries.

The data interfaces supported by the Yii framework mainly include the following three types:

Active Record

Query Builder

DAO

Used in this tutorial The sample database is

Chinook Database. The predecessor of this sample library is the famous NorthWind database. The currently supported data types are:

DB2

EffiProz

MySQL

Oracle

PostgreSQL

SQL Server

SQL Server Compact

SQLite

The data model is :

PHP development framework Yii Framework tutorial (23) Database-overview

This tutorial mainly uses MySQL, mainly because the database type used with PHP uses MySQL the most, so you need to install a MySQL database. The Yii framework supports many The interfaces that support access to these database types are basically similar, so although this tutorial uses MySQL as an example, the knowledge used is also applicable to other database types.

The above is the content of the PHP development framework Yii Framework tutorial (23) database-overview. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn