Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Drupal の t() 関数で % パーセント記号を出力するにはどうすればよいですか?
<?=t('% Daily Value') ?>
Drupalt()関数は%、変数参照演算子として@とを使用!します。違いは、文字列の置換時に変数に対して行われる置換の種類です。
t()
%
@
!
問題は、これが機能するためには、変数の正確な一致を の 2 番目の引数で配列キーとして指定する必要があるということt()です。あなたの例の場合、置換値の配列を提供していないため、置換は試行されません。
あなたの%サインは、エスケープする必要なく通過するはずです。