2013-06-27 155 views
-1

想从一个页面值传递给使用$ _SESSION 另一页它不工作会话变量不工作

<?php 

    $_SESSION['id']="12"; 
    $_SESSION['fname']="harsha"; 
    $_SESSION['date1']="2013-06-27"; 
    $_SESSION['time']="06:35:00"; 
    header('location:ex1.php'); 
?> 

想从ex1.php值传递给ex2.php

在ex2.php

​​

如果我想打印什么都不显示的值。

如何解决它...帮助我..

+0

你在你设置或读取任意文件需要一个'session_start'从会议 – andrewsi

回答

2

您需要ex1.php启动会话:

<?php 
    session_start(); 
    $_SESSION['id']="12"; 
    $_SESSION['fname']="harsha"; 
    $_SESSION['date1']="2013-06-27"; 
    $_SESSION['time']="06:35:00"; 
    header('location:ex1.php'); 
?>