在我的 PHP 代码中丢失会话时我遇到了一个大问题。我有 3 个表格(如 3 个步骤),当我从 2. 到 3. 会话时,我的数据从 1. 到 2. 步骤丢失。它只给了我从 2. 到 3 的当前元素。
真的我不知道是什么原因... :(我昨天尝试了 10 小时...
这个问题在 IE 和 Chrome 上,在 Opera 上是正常的。
我在谷歌中寻找:
chrome在页面之间丢失会话变量
我找到了三个网站:
1. 链接 - 关于 favicon.ico - 添加后,没有任何帮助...
2. SOF - 类似的问题- 但也没有......
我尝试添加到代码:
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 ----:
2.页面会话数组:
数组 ( [krajnadania] => Anglia [nadanie] => 10 [doreczenie] => Polska [odbior] => Sobota [ilosc] => 1 [waga] => 1 [wys] => 1 [gleb] => 1 [szer] => 1 [wynik] => 5.00 [koszt] => [zawartosc] => [uwagi] => )
在 3. 页:
数组 ( [krajnadania] => [nadanie] => [doreczenie] => [odbior] => [ilosc] => [waga] => [wys] => [gleb] => [szer] => [wynik] => [koszt] => 20 £ [zawartosc] => Sth1 [uwagi] => Sth12)
代码:
第二页:
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. 文件中写了 session var 'sth'
<?php
session_start();
$_SESSION['sth'] = 'STH';
print_r($_SESSION);
?>
我在每一页上打印会话,效果如下:
1:
数组 ( [sth] => STH [krajnadania] => [nadanie] => [doreczenie] => [odbior] => [ilosc] => [waga] => [wys] => [gleb] => [szer ] => [wynik] => [koszt] => [zawartosc] => [uwagi] => )
2:
Array ( [sth] => STH [krajnadania] => Anglia [nadanie] => 10 [doreczenie] => Polska [odbior] => Sobota [ilosc] => 2 [waga] => 1 [wys] => 1 [gleb] => 1 [szer] => 1 [wynik] => 5.00 [koszt] => [zawartosc] => [uwagi] => )
3:
数组 ( [sth] => STH [krajnadania] => [nadanie] => [doreczenie] => [odbior] => [ilosc] => [waga] => [wys] => [gleb] => [szer ] => [wynik] => [koszt] => 40 英镑 [zawartosc] => cos2 [uwagi] => 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>
会话正在工作:) 我仍在寻找问题。