how to print sql using model in yii2 code example Example: yii2 print model header('Content-type: text/plain'); print_r($var); exit;