php错误:为什么我向另一网页传送变量时,只得到前半部分,以空格开头的则全部丢失

网络整理 - 08-25

  PHP代码:--------------------------------------------------------------------------------

  [php]

  $Var="hello php";//修改为$Var=" hello php";试试得到什么结果

  $post= "receive.php?Name=".$Var;

  header("location:$post");

  [/php]

  --------------------------------------------------------------------------------

  receive.php的内容:

  PHP代码:--------------------------------------------------------------------------------

  [php]

  Echo "

";

  Echo

  PHP代码:--------------------------------------------------------------------------------

  [php]

  $Var="hello php";//修改为$Var=" hello php";试试得到什么结果

  $post= "receive.php?Name=".$Var;

  header("location:$post");

  [/php]

  --------------------------------------------------------------------------------

  receive.php的内容:

  PHP代码:--------------------------------------------------------------------------------

  [php]

  Echo "

___FCKpd___0";

  [/php]

  --------------------------------------------------------------------------------

  正确的方法是:

  PHP代码:--------------------------------------------------------------------------------

  [php]

  $Var="hello php";

  $post= "receive.php?Name=".urlencode($Var);

  header("location:$post");

  [/php]

  --------------------------------------------------------------------------------

  在接收页面你不需要使用Urldecode(),变量会自动编码.

GET["Name"];

  Echo "

";

  [/php]

  --------------------------------------------------------------------------------

  正确的方法是:

  PHP代码:--------------------------------------------------------------------------------

  [php]

  $Var="hello php";

  $post= "receive.php?Name=".urlencode($Var);

  header("location:$post");

  [/php]

  --------------------------------------------------------------------------------

  在接收页面你不需要使用Urldecode(),变量会自动编码.