Can I restore a PHP SESSION by its ID?

孤人 提交于 2019-12-01 19:01:24

问题


Im uploading files with the uploadify plugin. the PHP SESSION is lost during upload, is there a way to restore the session? Perhaps by its id?


回答1:


Yes. You need to add an option to uploadify:

$('#upload').uploadify({
    'scriptData':{'session_name':"<?php echo session_id(); ?>"}
});

And you need to add this to your PHP:

<?php
session_id($_POST['session_name']);
session_start();
?>

Then everything will be as expected.



来源:https://stackoverflow.com/questions/5352583/can-i-restore-a-php-session-by-its-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!