Home > PHP Framework > YII > body text

What features does yii2 have?

藏色散人
Release: 2020-07-20 10:23:00
Original
2801 people have browsed it

The features of yii2 are: 1. Comsoper is used in Yii2 to manage various dependencies; 2. Application security can be controlled; 3. Callback functions can be used in things; 4. Some new things are defined for things management. events; 5. There are two ways to introduce resources; 6. The view class is introduced.

What features does yii2 have?

New features of yii2 compared to yii

5 differences between yii2 and yii: composer , security events, transaction management, resource packages, view classes

Recommended: "yii Tutorial"

1. Composer: Comsoper has been used in Yii2 to manage various dependencies Relationship, you can use composer to install during installation

2. Security events: used to control the security of the application, use: Yii::$app->security->encrypt()

3. Transaction management:

(3.1) The biggest change is that you can use callback functions in things:

$connection->transaction(function() {
    $order = new Order($customer);
    $order->save();
    $order->addItems($items);
});
Copy after login

(3.2) Yii 2.0 also provides transaction management Define some new events so that you can better control the entire process of the thing during its life cycle. Events such as beginTransaction and commitTransaction are triggered when things are started and things are submitted respectively.

4. Resource package: There are two ways to introduce resources, one is through the AppAsset class in the assets directory, and the other is through a registration method similar to Yii1.

5. View class: The view class is introduced, which makes the implementation of the MVC pattern more complete. Different configurations such as similar themes. Correspondingly, the relevant presentation layer auxiliary classes are managed by the new view class, such as theme

The above is the detailed content of What features does yii2 have?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!