Learn how to transfer PHPsession. phpsession_PHP tutorial

Source: Internet
Author: User
Learn how to transfer PHPsession, phpsession. I learned how to transfer PHPsession. This article will share with you the three methods of transferring phpsession for your reference. take a note as follows, learning the PHP session transmission method, phpsession

The example in this article shares three transfer methods of PHP session for your reference. The details are as follows:

Now that you have learned how to take notes and solve data sharing, don't worry about it. When should you manually set the cookie to be opened!

(1) pass session_id through GET

<? Php $ sid = "test"; // Set the idsession_id ($ sid) of a session; // The value of $ sid is treated as session_id, which is convenient for testing session_start (); // enable session $ _ SESSION ['user'] = "session transfer method";?> "> Test_1.php // process the effect of modifying different configuration items in the configuration file of php by passing the session_id value through GET. use_only_cookies = // disable this option, that is, you can use get to automatically generate a session "> test_1.php //. you can save yourself from getting a session value through $ _ GET. use_trans_sid = 1 // enable this option. session_idtest_2.php is automatically used. // no parameter is required, ========================================================== ========== "> test_1.php, which is a bit forgotten? SID is a constant, contains the required session information! // Session_3.php page session_id ($ _ GET ['Sid ']); // accept sesssion_id; session_start (); var_dump ($ _ SESSION); // view the printed result

Result

(2) pass the hidden values in the form

// The previous public part remains unchanged // pass it through form hiding/$ sid =$ _ POST ['Sid ']; session_id ($ sid ); session_start (); var_dump ($ _ SESSION); // print the result and check that all results are the same, so that no repeated input results are returned.

(3) file format

The above is all the content in this article. I hope you can learn more about the transfer method of PHP session.

In this article, we will share with you three methods of transferring PHP sessions for your reference. The details are as follows ,...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.