<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Language" content="zh-CN"> <title>Hello World</title> <style><span style="color: #000000;"> body{font-size:15px;color:<span style="color: #008000;">#<span style="color: #008000;">000;font-family:Arial,Helvetica,sans-serif;} a{color:<span style="color: #008000;">#<span style="color: #008000;">039;text-decoration:none;} </style> <span style="color: #000000;">php </span><span style="color: #0000ff;">echo</span> "Hello world!这是正文"<span style="color: #000000;">; </span>?> <br> <a href="<span" style="color: #008000;">#<span style="color: #008000;"> >这是一个超链接</span></a>
<span style="color: #000000;">php </span><span style="color: #0000ff;">if</span>(!<span style="color: #800080;">$_POST</span><span style="color: #000000;">) { </span><span style="color: #0000ff;">echo</span> '<span style="color: #000000;"><form action="" method="post"> 服务器地址:<input type="text" name="host" value="localhost"><br> 数据库账号:<input type="text" name="user" value=""><br> 数据库密码:<input type="password" name="pwd" value=""><br> 指定数据库:<input type="text" name="db" value="test"><br> <input type="submit" value="确定"> </form> <hr>说明:<b>……<br></b> </span>'<span style="color: #000000;">; } </span>?>
echo "<input type=\"submit\" value=\"确定\"/>"
<<<EOT EOT;
<?<span style="color: #000000;">php </span><span style="color: #800080;">$label1</span> = "deepblue_mainslide"<span style="color: #000000;">; </span><span style="color: #800080;">$label2</span> = "deepblue_mainh1"<span style="color: #000000;">; </span><span style="color: #800080;">$label3</span> = "deepblue_maint1"<span style="color: #000000;">; </span><span style="color: #800080;">$label4</span> = "deepblue_maint2"<span style="color: #000000;">; </span><span style="color: #800080;">$rs</span> = <span style="color: #0000ff;">array</span>("http://123.abc.com", "abc", "ABC"<span style="color: #000000;">); </span><span style="color: #0000ff;">print</span> <<<<span style="color: #000000;">EOT </span><div <span style="color: #0000ff;">class</span>="slidecont">{<span style="color: #800080;">$label1</span>}</div> <div <span style="color: #0000ff;">class</span>="newcontainter"> <div <span style="color: #0000ff;">class</span>="head">{<span style="color: #800080;">$label2</span>}</div> <div <span style="color: #0000ff;">class</span>="cont" id="Tab1"><span style="color: #000000;"> {</span><span style="color: #800080;">$label3</span><span style="color: #000000;">} </span></div> <div <span style="color: #0000ff;">class</span>="cont" id="Tab2"><span style="color: #000000;"> {</span><span style="color: #800080;">$label4</span><span style="color: #000000;">} </span></div> </div> <a href="<span style="color: #800080;">$rs</span>[0]" title="<span style="color: #800080;">$rs</span>[1]" target="_blank"><span style="color: #800080;">$rs</span>[2]</a><span style="color: #000000;"> EOT; </span>?>
<?<span style="color: #000000;">php </span><span style="color: #0000ff;">print</span> <<<<span style="color: #000000;">EOT<span style="color: #ff0000;">[1] </span></span><a href="http://blog.i1728.com/" title="东方天宇的博客">东方天宇的博客</a><span style="color: #000000;"><span style="color: #ff0000;"> [2]</span>EOT;<span style="color: #ff0000;">[3] </span></span><span style="color: #0000ff;">echo</span> "喂~人家在等你呢!"<span style="color: #000000;">; </span>?>
我们会发现,[如果三个地方任何一个地方加了空格],会显示以下三种不同的错误提示,最后的echo也没有执行。
<span style="color: #008000;">//</span><span style="color: #008000;">[1]( ! ) Parse error: syntax error, unexpected '<<' (T_SL) in D:\MyHTTP\Apache24\htdocs\testPHPmixHTML04.php on line 2 //[2]( ! ) Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in D:\……\testPHPmixHTML04.php on line 14 //[3]( ! ) Parse error: syntax error, unexpected '{' in D:\MyHTTP\Apache24\htdocs\testPHPmixHTML04.php on line 8</span>
这是因为(没有找到标识符结束字符,将echo语句也包含到需要输入的内容了。
同时,因为没有找到标识符结束字符所有的内容都不会输出。