0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

phalcon - voltで変数の参照

Last updated at Posted at 2025-01-20

voltで定数やらグローバル変数を参照するために、php記述で妥協していたがvoltでいけるじゃないか。

クラス定数は

php
<?= ClassName::constant_field_name ?>

contantメソッドで定数の値をとってこれる。

volt
{{ constant('ClassName::constant_field_name') }}

global変数は

php
<?php global $GLOBAL_VARIABLE_NAME; ?>
<?= $GLOBAL_VARIABLE_NAME ?>

GLOBALSディレクティブでとってこれる。

volt
{{ GLOBALS['GLOBAL_VARIABLE_NAME'] }}
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?