How to transmit codeigniter-PHPsession between pages

Source: Internet
Author: User
Tags codeigniter
The problem of PHPsession passing between pages: premise: Use the codeIgniter framework and the session1. PHP's built-in session1. there is no problem on the pure apache server. 2. in Nginx apache mode, there is no problem with pages independent of the codeIgniter framework. 3. in apache mode of Nginx...

PHP session transmission between pages:
Prerequisites: Use the codeIgniter framework and the PHP session
1. There is no problem on the pure apache server
2. In Nginx apache mode, there is no problem with pages independent of the codeIgniter framework
3. in apache mode of Nginx, when a page is placed in the codeIgniter framework, there is a problem with session transmission between pages, that is, one page sets the session, and the other page cannot read the session set on the previous page.

Nginx apache mode: In the LNAMP environment, directly access port 8889, which is basically equivalent to directly accessing apache without Nginx. Use LuManager

In Nginx apache mode, there is no problem with pages independent of the codeIgniter framework.

In apache mode of Nginx, when a page is placed in the codeIgniter framework, there is a problem with session transmission between pages, that is, one page sets the session, and the other page cannot read the session set on the previous page.

Reply content:

PHP session transmission between pages:
Prerequisites: Use the codeIgniter framework and the PHP session
1. There is no problem on the pure apache server
2. In Nginx apache mode, there is no problem with pages independent of the codeIgniter framework
3. in apache mode of Nginx, when a page is placed in the codeIgniter framework, there is a problem with session transmission between pages, that is, one page sets the session, and the other page cannot read the session set on the previous page.

Nginx apache mode: In the LNAMP environment, directly access port 8889, which is basically equivalent to directly accessing apache without Nginx. Use LuManager

In Nginx apache mode, there is no problem with pages independent of the codeIgniter framework.

In apache mode of Nginx, when a page is placed in the codeIgniter framework, there is a problem with session transmission between pages, that is, one page sets the session, and the other page cannot read the session set on the previous page.

In Php, session IDs are transmitted between requests. There are three methods:

  1. The session id is passed through the cookie header in the http request.
  2. Pass the session id through the http get request, that is, put the session id in the url parameter
  3. Pass the session id through the http post request, that is, put the session id in the post data for Transmission

In my blog, I wrote an article describing the nature of php sessions in combination with http-the nature of sessions you must understand.

If you are interested, you can read it carefully. If you find anything inappropriate, you can refer to it in the comment and I will check and correct it. I hope more like-minded friends can share their technical ideas.

Why not put the session content in memcache?
First, this method belongs to a third party, and there is no exception in obtaining sessions between platforms. Second, you can set an accurate expiration time, and the access speed is fast, and the data is not implemented, you don't have to worry about the problems caused by the native session file storage method and the access speed problems in the database. A 64 GB memory server can handle the problem when the traffic is low. I am a little blind man. please correct me.

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.