Home > PHP Framework > YII > How to view the sql statements executed by the current program in yii2

How to view the sql statements executed by the current program in yii2

王林
Release: 2020-02-17 17:29:40
Original
3912 people have browsed it

How to view the sql statements executed by the current program in yii2

Examples are as follows:

Recommended tutorial: yii framework

$query = model::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pagesize' => '25',
            ]
        ]);
 
//获取当前程序执行的sql语句
$query->createCommand()->getRawSql();
Copy after login

For more programming related content, please pay attention to php Chinese website Programming tutorial column!

The above is the detailed content of How to view the sql statements executed by the current program in yii2. 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