我将div的内容存储在textaera中,然后将内容发布到另一个页面。
第二页应该简单地打印出 html,就好像它是直接写在该页面中的一样。
内容显示,除了在 html 中,它被打印为 ''"(例如在图像源和 ID 上
)为什么会发生这种情况,我该怎么做才能避免这种情况?
该网页:
<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>
尝试在 php 中 stripslashes() 来取消引号。请参阅 http://www.php.net/manual/en/function.stripslashes.php