【发布时间】:2016-05-24 07:45:23
【问题描述】:
当我使用 php short open tag 用 html 编写 php 代码时,它每次都打印 1。
<?= include_once 'includes/footer.php';?>
为什么会这样?
【问题讨论】:
-
您对包含文件的语法错误。= 是
-
不要使用 PHP 短标签,不推荐使用。
-
Do use short echo (
<?= ... ?>) 标签在使用 PHP 进行模板化时,即嵌入 HTML 或任何您作为文本输出的东西。 在 PHP 5.4 及更高版本中推荐并始终可用。这比使用<?php echo容易得多。也许有趣? Why are “echo” short tags permanently enabled as of PHP 5.4 -
@RyanVincent 我使用 () 标记所有内容。但我决定从下次开始使用 (= ?>) 标签进行打印。感谢您的宝贵建议。
标签: php