0

Previous I bumped into codes like this:

<?php
  $var="hello";
?>
<?=$var?>

It simply prints out the content of $var, so... is the syntax equivalent to echo $var? I'll also appreciate an answer pointing to a related manual page. Since the syntax is not searchable.

4

1 回答 1

2

是的,<?=$var?>是一样的<?php echo $var; ?>

来自 PHP.net 手册: echo 还有一种快捷语法,您可以在其中立即使用等号跟随开始标记。在 PHP 5.4.0 之前,此短语法仅适用于启用了short_open_tag配置设置。

你可以在这里阅读更多。

于 2013-09-08T09:29:47.517 回答