我将div的内容存储在textaera中,然后将内容发布到另一页。
第二页应该简单地打印出html,好像它是直接在该页面中写的一样。
内容显示除了“html中的所有内容,它被打印为\”(例如,在图像来源和ID上)
为什么会发生这种情况,我该怎么做才能避免呢?
html:
<textarea name="message" rows="10" cols="34"><table><tr>
<td style="color: #333333;table-layout:fixed;text-align:left;vertical-align:top;" id="imgCell3"><img src="https://www.pnrbuilder.com/_images/itinerary/airlines_AC.gif"><br>
AC # 7469</td>
<td class="itinCell">06:30 AM on Tue, October 22, 2013<br>
Newark/Elizabeth, NJ (EWR): Newark Liberty Intl. Airport</td>
<td class="itinCell">8:03 AM on Tue, October 22, 2013 <br>
Mississauga, Ontario, Canada (YYZ): Toronto Pearson Intl. Airport</td>
<br>
</tr>
</table></textarea><br /><br />
<input type="submit" value="POST"/>
php:
echo '<strong>This is the email content as it was posted to the page:</strong><br>'.$_POST['message'].'<br><br><br>';
生成的源代码由php回复:
<strong>This is the email content as it was posted to the page:</strong><br><table><tr>
<td style=\"color: #333333;table-layout:fixed;text-align:left;vertical-align:top;\" id=\"imgCell3\"><img src=\"https://www.pnrbuilder.com/_images/itinerary/airlines_AC.gif\"><br>
AC # 7469</td>
<td class=\"itinCell\">06:30 AM on Tue, October 22, 2013<br>
Newark/Elizabeth, NJ (EWR): Newark Liberty Intl. Airport</td>
<td class=\"itinCell\">8:03 AM on Tue, October 22, 2013 <br>
Mississauga, Ontario, Canada (YYZ): Toronto Pearson Intl. Airport</td>
<br>
</tr>
</table>
答案 0 :(得分:2)
在php中试试stripslashes()以取消引号。请参阅http://www.php.net/manual/en/function.stripslashes.php