PHP braces { } replace <?php ?>?
I've seen in someones source code they load template.tpl and inside is ...value="{$开发者_运维技巧phcode}"
...
does {$phcode}
replace <?php $phcode ?>
I don't find any reference in php manual.
A .tpl file isn't a PHP file and isn't parsed by the PHP engine. I'd guess you're looking at a Smarty template.
For the record, <?php $phcode ?>
does nothing. You are probably thinking of either <?php echo $phcode ?>
or <?= $phcode ?>
, either of which is pretty close to exactly what Smarty does with that piece of code, yes.
Most likely it is Smarty template.
More info here: http://www.smarty.net/syntax_comparison
It's not PHP, it's using a templating language like Smarty.
I'm pretty sure that's the Smarty PHP templating engine. It can do stuff like that, it makes templating easier with the integrated php execution.
No, {}
doesn't replace <?php ?>
, at least not as far as the PHP language is concerned. It's possible that your template engine searches for things inside {}
and then passes them to eval()
.
精彩评论