【问题标题】:How to check session in iframe如何在 iframe 中检查会话
【发布时间】:2013-10-18 11:36:12
【问题描述】:

我有一个名为 Index 的页面和一个页面聊天 检查会话编写打印代码echo session->user; 此代码在 chat.php 中有效,但在 index.php 中包含 chat.php echo session->user; 无效

e:g

  //index.php
<?php
 <iframe src="./chat.php"></iframe> 
enter code here
?>

//chat.php

<?php
include_once ('./session.php');
echo $session->user;
?>

chat.php 打印用户但index.php 不打印

问题出在哪里? 请帮忙

虽然这个问题是在 Firefox 中而不是在 IE 中的问题

【问题讨论】:

    标签: javascript php html session iframe


    【解决方案1】:

    对我来说,这适用于 iframe,像这样开始会话:

    header('P3P: CP="CAO PSA OUR"');
    session_start();
    

    【讨论】:

      【解决方案2】:

      在chat.php 和index.php 中记得包含

      session_start()
      

      除非它在你的 php.ini 中自动启动

      session_start()

      【讨论】:

      • 我已经在 chat 和 index.php 中写了 session_start() 但不起作用
      猜你喜欢
      • 2016-03-31
      • 1970-01-01
      • 2012-02-26
      • 1970-01-01
      • 2010-10-29
      • 2019-01-11
      • 1970-01-01
      • 2011-02-18
      • 2021-09-16
      相关资源
      最近更新 更多