0

I wonderd if theres a way you can do this ive seen it on some other php scripting where you do a variable like below

<?php //variable as {name} $name = "Jake"; ?> 

and you can show it by typing {name} or something like that if you include the file with php?

4

1 回答 1

1

Smarty 模板很好,但如果您不想担心包含 3rd 方库,并且您可以控制 php.ini 设置(启用 short_open_tags 指令),您可以使用短标签来执行以下操作:

<p>Here's some html... hello <?= $dynamicName; ?>, how are you today?</p>

或者

<? foreach($someArray as $val) : ?>
    <div><?= $val; ?></div>
<? endforeach; ?>
于 2013-09-26T17:00:26.977 回答