douji0073
2010-03-12 01:21
浏览 60
已采纳

php:在会话中保存整个$ _POST变量

Is this valid:

$_SESSION['pictures']['rateAlbum']['_POST'] = $_POST;

I want to save all of the POST data in the session in one shot.

edit: oh and what about the other way around:

$_POST = $_SESSION['pictures']['rateAlbum']['_POST'];

图片转代码服务由CSDN问答提供 功能建议

这是否有效:

  $ _ SESSION ['pictures'  ] ['rateAlbum'] ['_ POST'] = $ _POST; 
   
 
 

我想一次性保存会话中的所有POST数据。

编辑: oh以及相反的方法:

  $ _ POST = $ _SESSION ['pictures'] ['rateAlbum  '] ['_ POST']; 
   
 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douying4909 2010-03-12 01:49
    已采纳

    yes you can... if you save $_POST in $_SESSION in session you'll have the same array as post...

    You can also do the other way and save something to $_POST..

    you can also do that (or, using $_SESSION):

       $_POST = array('field1' => 'val1',
           'field1' => 'val1',
           'field1' => 'val1',
           'fieldn' => 'valn');        
       $_SESSION=$_POST;
    

    or

       $test="hi";
       $_SESSION['field1']="test";
       echo $$_SESSION['field1']; //this print hi       
    

    PHP is really flexible and let you do almost everthing, obviously pay attention on security problem...

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

相关推荐 更多相似问题