可以使用php定界符来输出复杂的html
<?php$name = 'Being' //下面<<<EOT后面不能有空格
print <<<EOT
<html>
<head>
<meta http-equiv="Content-Type" content="text/html charset=gb2312" />
<title>Untitled Document</title>
</head>
<body>
<!--12321-->
Hello,{$name}!
Hello,$name!
</body>
</html>
EOT //注意末尾的结束符必须靠边,其前面不能有空格?>
其实很简单,只要把html语句中的双引号改为单引号,然后直接用echo输出就行了:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<ul class="nav navbar-nav navbar-right">
<li class="nli"><a href="/About/">关于我们</a></li>
<li class="nli"><a href="/Notice/">舞蹈</a></li>
<li class="nli"><a href="/Instructors/">师资阵容</a></li>
</li></ul>
<?php
echo("<ul class='nav navbar-nav navbar-right'>")
echo("<li class='nli'><a href='/About/'>关于我们</a></li>")
echo(" <li class='nli'><a href='/Notice/'>舞蹈</a></li>")
echo(" <li class='nli'><a href='/Instructors/'>师资阵容</a></li>")
echo("</li></ul>")
?>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)