doubipiao1611 2012-04-07 08: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 08: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 怎么更换移动网络摄像头的通信模块实现公用
  • ¥15 vue但是页面显示的数据为空为什么呀,明明在钩子函数中已经成功赋值(相关搜索:输出数据)
  • ¥15 syri可视化不显示插入缺失
  • ¥30 运行软件卡死查看系统日志分析不出来
  • ¥15 C语言代码改正特征选择算法设计,贝叶斯决策,,设计分类器,远程操作代码修正一下
  • ¥15 String 类valuve指向的问题
  • ¥15 在ros2的iron版本进行编译时遇到如下问题
  • ¥18 vs用setup project打包项目实现安装完立即运行
  • ¥15 孟德尔随机化TwoSampleMR在线提取结局数据,遇到Error in check_reset(override_429)的问题
  • ¥15 ONNX转RKNN遇到问题
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部