doujiao1905
2013-02-12 19:48
浏览 68
已采纳

在php中保存会话变量中的所有$ _GET变量,并再次通过$ _GET访问它们

I would like to save all $_GET variables in a session variable and make them accessible trough $_GET again later on.

Some pseudo code / algoritm

page1.php send form with a field as <form action="page1.php" method="get"><input type="text" value="banan" name="apa">

page2.php save all $_GET variables

page3.php Set back all get-variables as in page2.php so the first variable is accessible trough $_GET['apa']

is this possible?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dtwupu6414 2013-02-12 19:57
    已采纳

    Don't do this. But to save:

    <?php
    
    session_start();
    $_SESSION["GET"] = $_GET;
    
    ?>
    

    and to retrieve:

    <?php
    
    session_start();
    $_GET = $_SESSION["GET"];
    
    ?>
    

    I think the real problem here is that you have a goal you want to accomplish and you think this is the right way of achieving that goal. It's not; there is most assuredly a better way of accomplishing the end result you want. But you have to tell us what that end result is supposed to be.

    评论
    解决 无用
    打赏 举报
查看更多回答(1条)

相关推荐 更多相似问题