[英]How many times can we use EOF?
I was used EOF
for print html code in PHP . 我曾用
EOF
在PHP中打印html代码。 for example : 例如 :
echo <<<EOF
Hello World!
EOF;
What volume of output can be used for eof
? 多少输出量可用于
eof
?
How many times can we use EOF
? 我们可以使用
EOF
多少次?
The technical name for this syntax is Heredoc . 该语法的技术名称是Heredoc 。
The PHP documentation doesn't specify a maximum length of content, however you would foolish to use it for very large amounts of text/HTML etc. as it makes your code unreadable and harder to maintain. PHP文档没有指定内容的最大长度,但是您会愚蠢地将其用于大量文本/ HTML等,因为这会使您的代码难以阅读且难以维护。
Example: If you have an HTML page which needs some customisation, far better to code the whole thing as a normal HTML file and add <?php echo "Hello World!"; ?>
示例:如果您有一个需要自定义的HTML页面,那么最好将整个内容编码为一个普通的HTML文件,并添加
<?php echo "Hello World!"; ?>
<?php echo "Hello World!"; ?>
in the appropriate place. <?php echo "Hello World!"; ?>
在适当的位置。 (This is how views in model-view-controller (MVC) work.) (这是如何视图模型-视图-控制器(MVC)的工作。)
You can use heredoc multiple times and with an identifier other than EOF
. 您可以多次使用heredoc,并且可以使用
EOF
以外的标识符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.