我在PHP代码中丢失会话时遇到了很大问题。当我从2到3时,我有3个表格(比如3个步骤)。会话从1到2步丢失我的数据。它只给出了从2到3的当前元素。
真的我不知道是什么原因...... :( 我昨天晚上10点试过......
这个问题出现在IE和Chrome上,在Opera中正常运行。
我在谷歌寻找:
chrome丢失页面之间的会话变量
我找到了三个网站:
1. Link - about favicon.ico - 添加后,没有任何帮助...
2. SOF - similar problem - 但也没有......
我尝试添加代码:
session_write_close();
session_save_path('/homez.764/name/tmp/');
.htaccess也没帮助(关于favicon):
#<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/.*(themes|wysiwyg|images|js)/
RewriteRule ^favicon.ico$ favicon.ico [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
#</IfModule>
(是的,我在每个网站上使用session_start())
如果可以,请帮助我,我从未在表格上花费太多时间......
提前致谢!
----编辑09:38 ----:
on 2. page session array:
数组([krajnadania] =&gt; Anglia [nadanie] =&gt; 10 [doreczenie] =&gt; Polska [odbior] =&gt; Sobota [ilosc] =&gt; 1 [waga] =&gt; 1 [wys] =&gt; 1 [gleb] =&gt; 1 [szer] =&gt; 1 [wynik] =&gt; 5.00 [koszt] =&gt; [zawartosc] =&gt; [uwagi] =&gt; )
on 3. page:
数组([krajnadania] =&gt; [nadanie] =&gt; [doreczenie] =&gt; [odbior] =&gt; [ilosc] =&gt; [waga] =&gt; [wys] =&gt; [gleb] =&gt; [szer] =&gt; [wynik] =&gt; [koszt] =&GT; 20£[zawartosc] =&gt; Sth1 [uwagi] =&gt; Sth12)
CODE:
第二页:
session_start(); $_SESSION['krajnadania'] = $_POST['krajnadania']; $_SESSION['nadanie'] = $_POST['nadanie']; $_SESSION['doreczenie'] = $_POST['doreczenie']; $_SESSION['odbior'] = $_POST['odbior']; $_SESSION['ilosc'] = $_POST['ilosc']; $_SESSION['waga'] = $_POST['waga']; $_SESSION['wys'] = $_POST['wys']; $_SESSION['gleb'] = $_POST['gleb']; $_SESSION['szer'] = $_POST['szer']; $_SESSION['wynik'] = $_POST['wynik']; print_r($_SESSION);
第三页:
session_start(); $_SESSION['koszt'] = $_POST['koszt']; $_SESSION['zawartosc'] = $_POST['zawartosc']; $_SESSION['uwagi'] = $_POST['uwagi']; print_r($_SESSION);
----编辑14:04 ----:
很棒,但问题仍然是......我在1. file
中写了会话var'sth'<?php
session_start();
$_SESSION['sth'] = 'STH';
print_r($_SESSION);
?>
我在每一页打印会话,这就是效果:
1:
数组([sth] =&gt; STH [krajnadania] =&gt; [nadanie] =&gt; [doreczenie] =&gt; [odbior] =&gt; [ilosc] =&gt; [waga] =&gt; [wys] =&gt; [gleb] =&gt; [szer] =&gt; [wynik] =&gt; [koszt] =&gt; [zawartosc] =&gt; [uwagi] =&gt; )
2:
数组([sth] =&gt; STH [krajnadania] =&gt; Anglia [nadanie] =&gt; 10 [doreczenie] =&gt; Polska [odbior] =&gt; Sobota [ilosc] =&gt; 2 [waga] =&gt; 1 [wys] =&gt; 1 [gleb] =&gt; 1 [szer] =&gt; 1 [wynik] =&gt; 5.00 [koszt] =&gt; [zawartosc] =&gt; [uwagi] =&gt; )
3:
每个页面都可以看到数组([sth] =&gt; STH [krajnadania] =&gt; [nadanie] =&gt; [doreczenie] =&gt; [odbior] =&gt; [ilosc] =&gt; [waga] =&gt; [wys] =&gt; [gleb] =&gt; [szer] =&gt; [wynik] =&GT; [koszt] =&gt; 40£[zawartosc] =&gt; cos2 [uwagi] =&gt; cos1)
$ _ SESSION ['sth']并且它没有清除...
----编辑17:28 ----:
我发现可能是这个问题的原因。当我删除index.php中的所有包含文件时,它开始工作。后来我逐步包含了文件......
当我有nivo-slider(jQuery图像滑块)时,它不起作用,当我删除行时:
<div class="slider-wrapper theme-default">
<div id="slider1" class="nivoSlider">
<img src="images/1.jpg" data-transition="fade" alt="" border="0" />
<img src="images/2.jpg" data-transition="fade" alt="" border="0" />
<img src="images/3.jpg" data-transition="fade" alt="" border="0" />
<img src="images/4.jpg" data-transition="fade" alt="" border="0" />
</div>
</div>
会议正在进行中:)我仍在寻找问题。