我有像
这样的数组中的html数据Array( [postedMsg] => <font color="blue">Blogger Wallpost</font>
[nbsp;<div_dir] => "ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-JrRECIxhi4s/TzpAs4lmgnI/AAAAAAAAAD4/KWcPpfXEGtU/s1600/800px-Cooked_Poha.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;">image</a></div><div class="separator" style="clear: both; text-align: center;">Happy Blogger Wallpost</div><br></div><div class="blogger-post-footer">image src</div>
)
我尝试使用像
这样的代码 foreach($htmlpostedMsg AS $key => $value)
{
$htmlpostedMsg[$key] = $value;
}
print_r($htmlpostedMsg[$key]);
只打印最后一部分,如
\"ltr\" style=\"text-align: left;\" trbidi=\"on\"><div class=\"separator\" style=\"clear: both; text-align: center;\"></div><div class=\"separator\" style=\"clear: both; text-align: center;\"></div><div class=\"separator\" style=\"clear: both; text-align: center;\"></div><div class=\"separator\" style=\"clear: both; text-align: center;\"><a href=\"http://4.bp.blogspot.com/-JrRECIxhi4s/TzpAs4lmgnI/AAAAAAAAAD4/KWcPpfXEGtU/s1600/800px-Cooked_Poha.jpg\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\">image src</a></div><div class=\"separator\" style=\"clear: both; text-align: center;\">Happy Blogger Wallpost</div><br></div><div class=\"blogger-post-footer\">image src</div>\n
答案 0 :(得分:2)
您可以简单地使用extract方法从POST值中获取关联数组
假设你有像$ _POST ['name']这样的帖子数组,$ _ POST ['email']
extract($_POST);
echo $name;// 'name you entered';
echo $email;// 'email you entered';
答案 1 :(得分:-2)
您可以在$_POST
上执行serialize,然后存储在mysql表中。