doubipiao1611 2012-04-07 16:30
浏览 55
已采纳

jQuery .load和PHP会话启动

I am currently working on a game in PHP and jQuery and at some point I will need to use the .load() from jQuery to load a PHP page into a div. That page will load some player information based on their login information, account id, etcetera, stored into an array inside $_SESSION["arrayname"].

It works perfectly on all sites, except those where jQuery load() is use. On easyphp, I got no errors, but on my web host server im getting this:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /fr/game/map.php:1) in fr/game/map.php on line 6

Here is my code:

<?php
 require_once("../../connectionRO.inc.php");

//used to check if we see the array in session, and i dont when i load it with jquery
if(!ISSET($_SESSION["comptejeu"])) 
{
    require_once('../../classInfoCompte.php');
    session_start(); 
    require_once('../../lg.php');
    require_once("./glg.php");
}

$ic = new infoCompte;
    $ic = $_SESSION["comptejeu"];   
?>

I understand that at this point a lot of stuff is already output to the page before that is loaded. Could anyone point me to a better way to retrieve the information that I need from that array to build my object from my class?

Thank you.

  • 写回答

2条回答 默认 最新

  • drnmslpz42661 2012-04-07 16:36
    关注

    Since you are getting this error as output started at /fr/game/map.php:1 (note: line 1) I will place money on you having whitespace or a BOM before the opening <?php tag in /fr/game/map.php.

    Make sure the opening < is the first character in the file. If you file is UTF-8, make sure it is UTF-8 without BOM, or convert it to ASCII.

    Wrong:

    
    <?php
    

    Right:

    <?php
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题