简体   繁体   English

如何将大量带有POST变量的HTML代码设置为PHP中的变量?

[英]How can I set large amounts of HTML code with POST variables to a variable in PHP?

$content = '<div id="contact" style="display:''; border-radius: 5px; padding: 20px;" class="center"><br><!--Spacing--><br><!--Spacing--></div>
<div id="contact" style="display:''; border-radius: 5px; background-color: #EBEBEB; padding: 20px;" class="center">
<form>
<center><h4><b>' . $_POST['email1'] . " " . $_POST['email2'] . '</b></h4></center>
<br><!--Spacing-->
<center>' . $_POST['email4'] . '<center>
<br><!--Spacing-->
<center>' . $_POST['email3'] . '<center>
<br><!--Spacing-->
<center>' . $_POST['email5'] . '<center>
<br><!--Spacing-->
<center><img src="rushforms/profile_images/' . $_POST['file_number'] . '.png"/></center>
<center><img src="rushforms/profile_images/' . $_POST['file_number'] . '.jpg"/></center>
<center><img src="rushforms/profile_images/' . $_POST['file_number'] . '.gif"/></center>
</form>
</div>';

How can I set all of this to $content ? 如何将所有这些都设置为$content

I was under the impression that ' ' could be used to set html code to a variable in php. 我的印象是“”可用于将html代码设置为php中的变量。

It will work but when you have such content it can be easier to use heredoc or nowdoc syntax . 它将起作用,但是当您拥有此类内容时,可以更容易使用heredoc或nowdoc语法

It will avoid all that concatenations. 它将避免所有这些串联。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM