Can I restore a PHP SESSION by its ID?

前端 未结 1 514
时光说笑
时光说笑 2021-01-19 06:29

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条回答
  • 2021-01-19 07:00

    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.

    0 讨论(0)
提交回复
热议问题