//a.php
<? session_start();//at the top of your file
$name="uGain";
session_register("name");
echo '<a href=b.php>b.php</a>';
?>//b.php
<? session_start();
echo $HTTP_SESSION_VARS["name"];
?>

解决方案 »

  1.   

    可以把數據庫連接的字符串放到session裡面
     這樣在每一個頁面都可以用去seesion取值了
      

  2.   

    这好说:
    如果你不用session传递对象变量,你就可以在程序的一开始使用session_start(),而且要保证在这句话的前面不能有超文本,一个空格也不行.
    如果你使用session传递对象变量,你就得在这个函数前面包含这个对象的类定义文件,而且这个文件中也不能有超文本(同样是一个空格都不行).
    使用session_start()就这么点要求.
      

  3.   

    <?php  // $Id: file_add_fujian.php,v 1.4 2002/12/06 09:11:07 Exp $
    require_once "../inc/config.php";
    include "../inc/confirm.php";
    include "../inc/lib.php";
    include "../inc/sys_var.php";
    include "../inc/log.php";
    ?>
    在每个文件前面包含config.php
    config.php里面是<?php
    session_start();
    。。
    ?>