[Smarty]PHPでセットしたdefine(“KEY”, “value”)の定数をSmaryで表示する
2016年1月13日
(カテゴリ: PHP:)
PHPでは、定数をdefine()関数で定義することができます。 viewのテンプレートにSmartyを使用している場合、この定数は$smarty.constで取得可能です。 以下、コード例です。 test.php <?php define("MESSAGE", "hello world");<?php define("MESSAGE", "hello world"); test.tpl {$smarty.const.MESSAGE}{$smarty.const.MESSAGE} これで…
続きを読む