函数中的"echo"或"echo"所有页面?

1 php

这是保存到变量中所有索引然后回显的好方法吗?例如

<?php
    $txt='<!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/html; charset=iso-8859-9" />
   <link rel="stylesheet" type="text/css" href="css/style.css"/>
   <title>Untitled Document</title>
   </head>

   <body>
  <div class="wrapper">
      <div class="header">
        <h2>'.heaf_func().'</h2>
      </div>
      <div class="content">content</div>
      <div class="footer">footer</div>
  </div>
  </body>
  </html>';
  echo $txt;

?>
Run Code Online (Sandbox Code Playgroud)

Ais*_*ina 8

我个人改变你的榜样是这样的;

<!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/html; charset=iso-8859-9" />
   <link rel="stylesheet" type="text/css" href="css/style.css"/>
   <title>Untitled Document</title>
   </head>

   <body>
  <div class="wrapper">
      <div class="header">
        <h2><?php echo heaf_func(); ?></h2>
      </div>
      <div class="content">content</div>
      <div class="footer">footer</div>
  </div>
  </body>
  </html>
Run Code Online (Sandbox Code Playgroud)