久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

未維護 PHP 會話變量

PHP session variables not being maintaned(未維護 PHP 會話變量)
本文介紹了未維護 PHP 會話變量的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個使用會話變量的應用程序,沒問題.我在使用 when 的每個頁面上的標題之前啟動會話,它一直很好然后似乎突然我在導航到設置會話變量的頁面以外的頁面時收到未定義的索引錯誤.但僅限于某些瀏覽器.有時會維護會話,有時則不會.

I have an application that has been working with session variables no problem. I start the session before the headers on every page that uses when, it has been fine then it seems all of a sudden I'm getting an undefined index error when I navigate to a page other than the one that sets up the session variables. But only on some browsers. Sometimes sessions are maintained and sometimes they aren't.

似乎有時不會存儲 cookie.我使用不同的瀏覽器進行了檢查,有時會存儲 cookie,有時不會.

It seems that cookies aren't being stored some of the time. I've done checks using different browsers and sometimes cookies are stored and sometimes not.

我做了一個實驗.我正在使用 Firefox 來使用應用程序,并且我一直在關注存儲會話的 tmp 文件夾.我把它清理干凈了.使用 firefox 我開始使用該應用程序,使用會話正在使用的所有頁面,最后我檢查了 tmp 文件夾,其中有一個會話文件.

I did an experiment. I was using firefox to use to app and I was keeping an eye on the tmp folder where the sessions are stored. I cleaned it out. Using firefox I started using the app, using all the pages that sessions were in use and at the end I checked the tmp folder and it had one session file in there.

與 Internet Explorer 完全相同,現在有 7 個不同的會話文件.

Did the exact same with internet explorer and there are now 7 different session files.

我將 PHP 5.3.0 與 WAMP 堆棧一起使用.阿帕奇 2.2.11.在我的 phpinfo() 中啟用了會話支持.

I'm using PHP 5.3.0 with the WAMP stack. Apache 2.2.11. Session support is enabled in my phpinfo().

我在第一頁調用 var dump 并打印出會話數據.在任何后續頁面上,會話變量為空.

I call a var dump on the first page and it prints out the session data. On any subsequent pages the session variable is empty.

<?php var_dump($_SESSION); ?>

array(0){}

誰能幫我想辦法解決這個問題?

Can anyone help me figure out a solution to this?

更新 - PHP INI 會話設置

Directive        Local Value     Master Value
session.auto_start Off           Off 
session.bug_compat_42 On         On 
session.bug_compat_warn On       On 
session.cache_expire 180         180 
session.cache_limiter nocache    nocache 
session.cookie_domain 82.68.26.169   82.68.26.169 
session.cookie_httponly Off      Off 
session.cookie_lifetime 0        0 
session.cookie_path /            / 
session.cookie_secure Off        Off 
session.entropy_file no value    no value 
session.entropy_length 0         0 
session.gc_divisor 1000 1000 
session.gc_maxlifetime 1440      1440 
session.gc_probability 1         1 
session.hash_bits_per_character 5 5 
session.hash_function 0 0 
session.name PHPSESSID           PHPSESSID 
session.referer_check no value   no value 
session.save_handler files       files 
session.save_path c:/wamp/tmp    c:/wamp/tmp 
session.serialize_handler php    php 
session.use_cookies On           On 
session.use_only_cookies On      On 
session.use_trans_sid 0          0 

更新 - 解決方案

因為我的應用程序使用 iframe 從另一個域(我創建的)拉入頁面,所以我試圖設置的 cookie 被阻止.設置一個P3P頭,問題似乎解決了!

Because my app was using iframes pulling in pages from another domain (which i created) the cookies i was trying to set were being blocked. Setup a P3P header and the problem seems to be solved!

推薦答案

我的建議來自 您之前的問題 仍然有效:請比較會話 ID.

My suggestion from your previous question still stands: please compare session ids.

解決方案可能就像您的瀏覽器不接受會話 cookie 一樣簡單.

The solution might be as simple as your browser not accepting session cookies.

您可以通過調用 session_id() 來檢索會話 ID.在 session_start() 之后立即執行它應該給你一個常量值 如果 會話是相同的.否則,對于每個請求,都會實例化一個新會話.

You retrieve the session id by calling session_id(). Do that right after session_start() it should give you a constant value if the session is the same. Otherwise for every request a new session is instantiated.

同時檢查C:wamp mp.此目錄中的無數文件可能表示每個請求的新會話.

Also check C:wamp mp. A gazillion files in this directory might indicate fresh sessions for each request.

EDIT 由于我們已經確認了每個請求的新會話,現在是時候確定是否接受會話 cookie.檢查瀏覽器的設置并確認可以找到名稱為 PHPSESSID 的域的 cookie(我猜是localhost").

EDIT Since we've confirmed new sessions per request, it's time to find out whether session cookies are accepted. Check the settings of your browser and confirm that a cookie for your domain (I guess it's "localhost") with the name PHPSESSID can be found.

這篇關于未維護 PHP 會話變量的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 亚洲精品久久久久久首妖 | 国产精品不卡视频 | 免费人成激情视频在线观看冫 | 午夜精品久久久久久不卡欧美一级 | 欧美自拍第一页 | 一区二区精品 | 一区二区三区不卡视频 | 中文字幕在线人 | 色爽女| 国产精品欧美一区二区三区 | 少妇一级淫片aaaaaaaaa | 国产午夜精品一区二区三区嫩草 | 91高清视频| 欧美一区二区三区精品免费 | 巨大黑人极品videos精品 | 久久中文字幕一区 | 成人久久久 | 欧美一级二级在线观看 | 毛片在线免费 | 天天干天天草 | 伊人在线 | 香蕉视频91 | 午夜视频一区二区三区 | 四虎影视在线 | 国产一区二区三区色淫影院 | 欧美精品一二三区 | 岛国av免费观看 | 久久天堂| 91免费观看国产 | 毛片一级黄色 | 欧美日韩视频在线 | av中文字幕在线观看 | 欧美影院 | 一区二区在线不卡 | 欧美一区二区三区四区五区无卡码 | 国产高清在线观看 | 天天影视综合 | 中文字幕在线一区二区三区 | 丝袜美腿一区二区三区动态图 | 一区二区三区欧美在线观看 | 亚洲国产高清高潮精品美女 |