我想发送html数据,如
<div style='padding: 0px; overflow: auto; width: 194px;' id='bar1'><div style='float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 60px'><div style='float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;'></div></div></div>
从一个php页面到另一个。 我已尝试通过POST执行此操作,但所有div数据都在我发送html数据的页面中对此进行了更改,
<div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 20px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 20px\'></div><div style=\'clear:both; width: 100%; background-color: #FFFFFF; color: #000000; text-align: center; font-size: 11px; margin-top: 5px;\'>asdc</div>
任何人都可以告诉我这里我的错误在哪里以及如何在php页面之间保持数据的完整性。
编辑1: 发送数据的代码如下(#pdf_data是textarea)
function export_as_pdf2(div_id)
{
removeAllLinks('remove');
div_id = 'bar1';
var content = $('#'+div_id).html();
content=content.replace(/\"/g,'\'');
$('#pdf_data').val(content);
$('#pdf_format_form').submit();
}
答案 0 :(得分:0)
魔术引用在你的php.ini设置中启用,这就是为什么它会自动为每个引号添加斜杠()的原因。关闭魔术引用,因为这是一个很好的做法。如果没有,请使用stripslashes($ _ POST ['post_var'])。不要再使用$ _REQUEST了,这不是一个好习惯。