In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces how to solve the problem that php session can not transmit value. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Php session can not pass the value of the solution: 1, view the server's parameter configuration; 2, in the configuration file php.ini, change the value of "session.use_trans_sid" to 1; 3, check whether the "var/tmp" folder can be written and modified.
This article operating environment: Windows7 system, PHP7.1, Dell G3 computer.
What if php session cannot pass a value?
The solution of non-transmission of PHP session failure
In PHP, session cannot be passed to the next page. There are generally two situations:
Let's first write a php file: send it to the server to see the parameter configuration of the server.
Go to the session section and see that the session.use_trans_sid parameter is set to zero.
This parameter specifies whether transparent SID support is enabled, that is, whether session is passed along with URL. My personal understanding is that once this parameter is set to 0, then each URL will start a session. In this way, the later page cannot trace the session of the previous page, that is, what we call untransferable. The two pages generate two session documents on the server side, and there is no correlation. I wonder if this understanding is correct? Ask the master for advice. )
So one way is to change the value of session.use_trans_sid to 1 in the configuration file php.ini.
Of course, we know that not everyone has the authority to change the configuration of php, so is there any indirect solution?
Here are two examples to illustrate:
File 1 test1.php
File 2: test2.php
Every page should be written to open session. Otherwise, it still won't work properly.
So, the point is to add session_id (SID) before session_start (); so that when the page is converted, the server uses the session saved by the user in the server session folder, which solves the problem of delivery.
However, the same shoes will reflect that, in this way, multiple users' session is written in one SID, and the value of Session can not be brought into full play. So there is another way to solve this problem, without adding session_id (SID); as long as you have configured permissions on the server's php.ini:
If you change output_buffering to ON, it doesn't make sense.
The second possible reason is that the server does not have read permission to the folder where the session is saved, or go back to phpinfo.php and check the address saved by session:
Session.save_path: var/tmp
So just check if the var/tmp folder is writable.
Write a file: test3.php to test:
If you return bool (false) to prove that the folder write permission is restricted, change the folder and add it to the web page you wrote:
/ / set the session subfolder under the current directory to the session save path.
$sessSavePath = dirname (_ _ FILE__).'/ session/'
/ / if the new path is readable and writable (by changing the folder property to 777 on FTP), let the path take effect.
If (is_writeable ($sessSavePath) & & is_readable ($sessSavePath))
{session_save_path ($sessSavePath);}
About how to solve the problem of php session can not pass value to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.