PHP heredoc 用法2

参考网上的一个heredoc php模板实现的简单代码:index.php文件:

<?php
function template($template,$EXT ='htm')
{
$path = "$template.$EXT";
return $path;
}
$title = "this is title";
$content = "heredoc";
include template('index')
?>

index.htm 文件;

<!-- <?php print<<<EOT
-->
<html>
<head><title>$title</title></head>
<body>
$content;
</body>
</html>
<!--
EOT;
?>-->

  

原文地址:https://www.cnblogs.com/igoogleyou/p/phpdocss.html