如果是在页面间传值,还有种较易理解的方法,不过也麻烦。
<?
//在页面1中把数组连成一个字串。
foreach($array as $key){
  $str.=$key.",";
}
//在用form将$str提交到页面2。
echo '<form>';
echo '<input type=hidden name=str value='.$str.'>';
echo '</form>';
?>
在页面2中将得到的$str还原成数组。
<?
$array=explode(',',$str);
?>
唉,麻烦是很麻烦啊。

解决方案 »

  1.   

    本函式会跟着标头 Header 送出一段小资讯字串到浏览器。使用本函式要在送出 HTML 资料前,实际上 cookie 也算标头的一部份。本函式的参数除了第一个 name 之外,都是可以省略的。参数 name 表示 cookie 的名称;value 表示这个 cookie 的值,这个参数为空字串则表示取消浏览器中该 cookie 的资料;expire 表示该 cookie 的有效时间;path 为该 cookie 的相关路径;domain 表示 cookie 的网站;secure 则需在 https 的安全传输时才有效。想得到更多的 cookie 资讯可以到 http://www.netscape.com/newsref/std/cookie_spec.html,由 cookie 原创者 Netscape 所提供的完整资讯。
    <?php
     session_register('aa');
     $aa=array(1,2,34,5,6,7,7,7,2,7,7,77,1234123);
     ?>
     <A HREF="test.php">到下一页去取这个数组.test.php
    <?php
    session_start();
    print "以下是session数组传过来的内容:";
    print_r($_SESSION['aa']);
    ?>
      

  2.   

    to anziqi(美洲狮) :
    你行,我佩服,謝謝!還有高手來沒!!
      

  3.   

    to anziqi(美洲狮) :
    <?php
     session_register('aa');
     $aa=array(1,2,34,5,6,7,7,7,2,7,7,77,1234123);
     ?>
     <A HREF="test.php">到下一页去取这个数组.test.php
    <?php
    session_start();
    print "以下是session数组传过来的内容:";
    print_r($_SESSION['aa']);
    ?>怎麼在我的電腦中調試,沒有輸出值??
      

  4.   

    我來回答算了,
    在文件前都加session_start();