Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP会话ajax不同步_Php_Jquery_Ajax_Session - Fatal编程技术网

PHP会话ajax不同步

PHP会话ajax不同步,php,jquery,ajax,session,Php,Jquery,Ajax,Session,页面show2.php: <?php session_start(); $_SESSION["abc"]=2; print $_SESSION["abc"]; include 'import/function.php'; ?> <html> ............. </html> 当我进入show1.php时,页面print 1和ajax_调用print 1。 当我进入show2.php时,页面会打印2,但ajax会调用打印

页面show2.php:

<?php 
   session_start();
   $_SESSION["abc"]=2; 
   print $_SESSION["abc"];
   include 'import/function.php';
?>
<html>
 .............
</html>
当我进入show1.php时,页面print 1和ajax_调用print 1。
当我进入show2.php时,页面会打印2,但ajax会调用打印1!为什么?

向我们展示ajax调用,function.php在做什么?您确定没有复制
$\u SESSION[“abc”]=1编码到处理post的php脚本中?
<?php 
   session_start();
   $_SESSION["abc"]=1; 
   print $_SESSION["abc"];
   include 'import/function.php';
?>
<html>
 .............
</html>
session_start();
include 'import/function.php';
if(isset($_POST["data"]))
{
    print $_SESSION["abc"];
}