LoginSignup
4
0

More than 3 years have passed since last update.

Smartyのtplファイルでデバッグする方法

Posted at

smarty

Smartyは、PHPで実装され、主にPHPアプリケーションで使用されるテンプレートエンジンです。
今回は、smarty側でのvar_dumpする方法の紹介になります。

tplファイル

{{$array_test = ["a" => "aaa", "b" => "bbb", "c"]}}

{{$array_test|@var_dump}}

viewページ

array(3) {
  ["a"]=
  string(3) "aaa"
  ["b"]=
  string(3) "bbb"
  [0]=
  string(1) "c"
}

と表示されます。
画面上で見やすくするためには

{$array|@debug_print_var}

でも良いかもしれません

4
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
4
0