0
0

More than 3 years have passed since last update.

CakePHP3でdebug()関数が効かない時

Last updated at Posted at 2019-10-30

debug()関数が効かない!?

メモ用。

変数やオブジェクトの中身を確認したい時、debug()関数が便利です。

<?php

$testId = 1234;
$assets = $this->AppTests->find()->where(['AppTests.id' => $testId]);

debug($assets);

上記のように記述することで、$assets変数の中を確認することができます。
ブラウザ上などで確認が可能。

なぜか中身が見えない時

debug関数を使っても、中身が確認できない場合は、DEBUGモードがOFFになっている可能性があります。

「config>app.php」を確認

<?php
return [
    'debug' => true,

上記のようにデバッグモードがtrueになっていたら問題ありません。

ただし、本番環境ではここをOFFにしてください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0