久久久久久久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)
主站蜘蛛池模板: 完全免费在线视频 | 中文字幕一区二区三区四区 | 自拍偷拍在线视频 | 啪啪免费 | 九九热免费视频在线观看 | 久久精品欧美一区二区三区不卡 | 国产高清视频一区 | 欧美视频网| 91欧美激情一区二区三区成人 | 一区二区三区精品 | 日本成人福利视频 | 国产久 | 久久免费香蕉视频 | 成人免费淫片aa视频免费 | www.日日操 | 羞羞视频免费在线观看 | 亚洲成人av | 91视频大全 | 欧美日韩91| 久久免费视频1 | 免费在线观看成人 | 国产亚洲精品一区二区三区 | 午夜色婷婷 | 日韩精品一区二区三区中文字幕 | 91在线一区二区 | 激情六月丁香婷婷 | 亚洲成人免费 | av在线播放不卡 | 91在线精品视频 | 日韩一区二区成人 | 爱草视频| 中文字幕精品一区二区三区精品 | 久久99深爱久久99精品 | 欧美三级电影在线播放 | 久久久久亚洲精品 | 国产一级片免费看 | 欧美一区| 久久久久午夜 | 日韩午夜场 | 欧美精品日韩精品国产精品 | 中文字幕日本一区二区 |