关于发布数据

时间:2010-03-30 11:23:51

标签: php

everyone.my这样的问题:

post.php中

<?php
$str = "testmytest";
$str_serialize = serialize($str);

http_post_fields("get_post.php", array('str' => $str_serialize));
?>

get_post.php

<?php
if (isset($_POST['str']))
{
  $echo $_POST['str'];

  $str = unserialize($_POST['str']);

  echo $str;
}
?>

我无法反序列化$ str,它已被更改。谁知道为什么? 谢谢大家。

2 个答案:

答案 0 :(得分:1)

您需要为associative array功能提供http_post_fields

http_post_fields("get_post.php", array('str' => $str_serialize));

答案 1 :(得分:0)

http_post_fields()中的数据参数应如下所示:

http_post_fields('get_post.php', array('str' => $str_serialize));