我需要存储用户的搜索结果,并在回发时再次显示结果。
答案 0 :(得分:1)
<?php session_start(); //to start session
$_SESSION['search_result'] = $_REQUEST['search_result'];
//$_REQUEST['search_result'] is the data you get from GET Mehthod or POST Method of variable search_result
?>
To acess it on other page
<?php
session_start();
$search_result = $_SESSION['search_result'];
答案 1 :(得分:0)
//page 1
session_start();
$_SESSION['postback'] = serialize($msg);
//page 2
session_start();
$msg = isset($_SESSION['postback'])?unserialize($_SESSION['postback']):'';
但是,不要使用这样的会话。