LoginSignup
0
0

More than 3 years have passed since last update.

laravel helper を共通関数を自作しよう

Last updated at Posted at 2018-11-12

グローバル関数をまとめちゃえ。

[ 参考 ]
https://qiita.com/ryokurosu/items/5365e6a3c354d4731a3b

一度作って json もやりゃ、helper.phpを変更しただけで動く。

helper.php

<?php

function pd($var) {
    $array = debug_backtrace();
    echo "<div align='left'><pre style='font-size:14px;background-color: black;color: #fff;'>";
    echo '<b style="font-weight:bold;">'.$array[0]['file']." (line ".$array[0]['line'].")".'</b><br />';
    print_r($var);
    echo "</pre></div>";
}


?>


これで適当なコントローラーで pd(); やればデバッグ情報が、わかりやすく表示される。

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