<?php
//PHP 多行字符串的赋值方法
//<<< string 里面的 string 是可以随机其他的标记
$article = <<<string
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>新建H5模板</title>
</head>
<body>
<h3>阅谁问君诵,水落清香浮</h3>
</body>
</html>
string;
echo $article;
?>
思路:
<?php
//统一使用这一个“___”会不会更好
$article = <<<___
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>新建H5模板</title>
</head>
<body>
<h3>阅谁问君诵,水落清香浮</h3>
</body>
</html>
___;
echo $article;
?>
效果图:
标签:多行,H5,问君,清香,赋值,article,PHP,模板,echo From: https://blog.51cto.com/u_16171388/6558654