<html> <head> <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</span>-size:15px;color:<span style="color: #008000;">#</span><span style="color: #008000;">000;font-family:Arial,Helvetica,sans-serif;}</span> a{color:<span style="color: #008000;">#</span><span style="color: #008000;">039;text-decoration:none;}</span> </style> </head> <body> </b> <?<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><span style="color: #008000;"> >这是一个超链接</a> </b> </body> </html>
<?<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 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>?>
[세 위치 중 하나에 공백이 추가된 경우] 다음 세 가지 오류 메시지가 표시됩니다. 구현 끝에 에코.
<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>
(<<