Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
324 views
in Technique[技术] by (71.8m points)

php - Yii - echo the last query

I have used Codeigniter before and it has a feature that will echo the last database query - really useful for debugging.

eg...

$this->getSomeData->findAll();
Yii command to output this single query e.g SELECT * FROM TABLE...

Does Yii have a similar feature to simply show the very last query executed?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this in your config file. You can see the query and other details at the bottom of the page.

'db'=>array(
        'enableProfiling'=>true,
        'enableParamLogging' => true,
),
'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
        …
        array(
            'class'=>'CProfileLogRoute',
            'levels'=>'profile',
            'enabled'=>true,
        ),
    ),
),

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...