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条)

报告相同问题?

悬赏问题

  • ¥30 天体光谱图的的绘制并得到星表
  • ¥15 PointNet++的onnx模型只能使用一次
  • ¥20 西南科技大学数字信号处理
  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧,别用大模型回答,大模型的答案没啥用