从php控制器将html文件渲染为html

时间:2019-10-22 18:38:44

标签: php html render

已更新:

有人可以解释为什么第一种方法显示为纯文本,而第二种方法显示为html吗?我正在尝试将文件内容显示为html。

    <?php
echo getcwd() . '<br>';

方法1

$body = file_get_contents('wp-content/themes/twentytwelve-child/views/html/email-footer.html');
echo $body;

方法2

$body = '<!DOCTYPE html> <html>
   <head>
       <style>
           div{
               font-size:5vw!important;
              }
         #img1{
               width:100%!important;
              }
       </style>
</head>
<body lang=EN-US>
   <div style="text-align:center;margin:0 auto;font-size:16px">
      <!-- <img id="img1" style="width:70%;" src="cid:swag-logo">-->
       <p> Hi, <br><br> Thank you for your interest in Sustainable Weston
           Action Group. If you would like to sign up for our quarterly
           newsletter or have specific areas of interest/expertise that you
           would like to share,please complete  
           <a href=" https://www.sustainablewestonma.org/get-involved/" >our 
           Get Involved form</a> This information is for Sustainable Weston
           Action Group use only - we will not share your information with any 
           other parties.<br><br><br>Sustainable Weston Action Group</p>
    </div>
</body>
</html>';

echo $body; 

?>

0 个答案:

没有答案
相关问题