≮六づ道≯的Blog

天行键,君子以自强不息! & 路漫漫其修远兮,吾将上下而求索!

黄殿瑶ID:feel8
182391次访问,排名348好友0人,关注者1
feel8的文章
原创 195 篇
翻译 0 篇
转载 1 篇
评论 100 篇
六道的公告
远离3721,还我一片静土!
 ╲█◤
◢██◣
   ◤◥
临渊羡鱼不如退而结网苦练内功ING -_-!!

昵称:≮六づ道≯
Mail:PHP5@QQ.COM
留言:点击留言




今日天气

最近评论
psnccs:WoW Gold
psnccs:WoW Gold
Eeeethan:不好意思,我想請教一個關於編譯Apache過濾器範例的問題,可能很初級,不過我確實找不到解答。我的問題是:
想請問怎麼要在Linux下用Gcc編譯:
httpd-2.2.4\modules\experimental\
裡的mod_case_filter.c
我下了
gcc -fPIC -I$../../include -c mod_case_……
风云★小子:一名刚学生!
你的时钟代码是什么啊?
南京甜蜜爱成人用品商城:<b>南京最大的零售、批发、加盟成人用品、性用品的网站[www.honey025.com],2000多种产品任您选购,1766个县市货到付款、3重

包装保密邮寄,主营:成人用品、性用品、性保健品、避孕用品、情趣内衣、壮阳药、阴茎增大丸、SM用品、安全套、男女自慰性器

具等</b><p>
[url=http://w……
文章分类
收藏
    相册
    我的相册
    My Links
    ChinaUNIX
    CSDN论坛
    Fedora官方网站
    LinuxEden
    LinuxSir
    mySQL官方网站
    PHP官方网站
    SmartTemplate
    中国赢网
    落伍者论坛
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 关于PHP--session的问题集锦解决方案 收藏

    新一篇: 浅析php中实现多线程~

    PHP的session功能,一直为许多的初学者为难。就连有些老手,有时都被搞得莫名其妙。本文,将这些问题,做一个简单的汇总,以便大家查阅。
        
       1.
       错误提示
       Warning: Cannot send session cookie - headers already sent
       Warning: Cannot send session cache limiter - headers already sent
       分析及解决办法
       这一类问题,的原因是你在程序中使用session_start()时,之前已经有实际的html内容输出了。或许你说,我没有啊,我只不过是echo或print一条消息了。很抱歉,你的echo或print语句所产生的输出,就是实际的html内容输出。解决此类问题的办法是,将你的session_start()调到程序的第一行。
        
       2.
       错误提示
       Warning: open(F:/689\php\sessiondata\sess_66a39376b873f4daecf239891edc98b5, O_RDWR) failed
       分析及解决方法
       出现这样的错误语句一般是因为你的php.ini中关于session.save_path一项没有设置好,解决的方法是将session.save_path和session.cookie_path 设置置为
       session_save_path = c:\temp
       session.cookie_path = c:\temp
       然后在c:\目录下建立一个temp目录,即可
        
       3.
       错误提示
       Warning: Trying to destroy uninitialized session in
       分析及解决方法
       出类这样的提示,一般情况都是你直接调session_destroy()函数造成的。很多的朋友认为session_destroy()函数可以独立的运行,其实不然。解决的方法是在你调session_destroy()函数之前,要用session_start()开启session的功能。
        
       4.问题:怎么获得当前session的id值呢?
       最简单的方法是:
       echo SID;
       你会发现的。
        
       5.问题:我的程序,在调用header函数之前没有任何的输出,虽然我include了一个config.php文件,但在config.php文件中也没有任何的输出,为什么session还是会报出与问题1同样的错误呢,是不是因为我在header之前用了session_start()的缘故呢?
       答:或许你确实认真的检查了你的php程序,在引用header()之前确实也没有任何的输出,并且在你的include文件中也没有任何的输出!但是你是否用光标键在?>这个PHP代码结束语句后移动检查呢?那么你会发现在?>这个后面,有一个空行或几个空格,你删除了这几个空行或空格,那么问题就解决了。
       注:此问题,会出PHP4.1.2中,更高版本,没有测试过。
        
       6.问:用session做登录主页面后,其它页面怎么用session限制登录。。。
       答:最简单的方法是
       session_start();
       if(!session_registered(\'login\') ││ $login != true) {
       echo \"你没有登陆\";
       exit;
       }
        
       7.问:我用session_register()注册了session变量,可是当我用header或用javascript的重定向语句,那么在一下页面中,我却访问不到session所注册的变量值。请问如何解决?
       问题的程序片段:
           session_start();
       $ok = \'love you\';
       session_register(\'ok\');
       header(\"location : next.php\");
       ?>
        
       next.php
           session_start();
       echo $ok;
       ?>
        
       解决的方法:
       当你用header函数或window.location这样的功能后,你上一个页面所注册的session变量,就会容易的丢失,关于这个问题的原因,至今仍没有一个详细的回答。
       不过有解决的方法。如下所示
       header(\"Location: next.php\" .\"?\" . SID);
       在跳转到下一页面的时候,将session的当前id做为一个参数,传到后一个页面。
        
       8.session如何传数组
       session_register(\'data\');
       $data=array(1,2,3,4);
        
       方法是先注册后赋值
        
       9.问题9:我是不是可以用像$HTTP_GET_VARS[\'**\']方式来访问session值呢?
        
       回答:可以,你可以使用如下global数组来访问session,以加强网页的安全性
       $HTTP_SESSION_VARS
       $_SESSION
       例程:
           session_start();
       $username = \'stangly.wrong\';
       session_register(\'username\');
        
       echo $HTTP_SESSION_VARS[\'username\'];
       echo \'
       \';
       echo $_SESSION[\'username\'];
       ?>
       请参照此例程修改符合您自己的程序。
        
       问题10:session_unregister() 和 session_destroy() 有何区别?
       session_unregister()函数主要作用是注消当前的一个session变量。不过要注意的是,如果你用$HTTP_SESSION_VARS或$_SESSION在当前页面中引用过session变量,那么你可能需要和unset()配合 来注消session变量。
       而session_destroy()是清除当前的session环境。意思就是说,当你用session_destroy()函数后,那么你就不可能再用session_is_registered()来检测session的变量了。但是需要注意的是他不能清除global中的session或使用了session cookie的中的session.所以在用session_destroy之前,最好不要用$HTTP_SESSION_VARS $_SESSION来访问session.(译自于php.net)
        
       例程:
       if(isset($_COOKIE[session_name()])) {
       session_start();
       session_destroy();
       unset($_COOKIE[session_name()]);
       }
        
        
       以上,所述是一些新手经常遇到的问题。或许是详述不清,难免有误所在,请高手指点批评。

    发表于 @ 2004年10月29日 20:00:00|评论(loading...)|编辑

    旧一篇: 在PHP中使用与Perl兼容的正则表达式

    评论

    #leinchu 发表于2004-12-23 15:41:00  IP: 220.166.205.*
    不错。

    我有其它的疑问,php.ini中session.use_cookies = 0 ,那么我所有的cookie似乎都立即失效了,session.use_cookies = 1有危害吗?比如说cookie改写?

    另外请问
    session.cache_limiter = nocache,provate,public是和意思,我试过多次但始终没办法搞清楚。

    我的cdsn,是leinchu,或者请就在这评论后面回答,谢谢!
    #Plee 发表于2005-01-11 18:50:00  IP: 218.22.146.*
    session.use_cookies = 0 不使用cookie在客户端保存session id.
    cookie不应该失效,session会失效,除非在url后加上session名=sessionn id

    session.cache_limiter = nocache,provate,public 是什么意思我也搞不清楚。
    #Plee 发表于2005-01-11 18:52:00  IP: 218.22.146.*
    http://www.phord.com/experiment/cache/

    nocache,provate,public
    #Plee 发表于2005-01-11 18:53:00  IP: 218.22.146.*
    I found this odd problem with IE and uncached executable content. In my case, the executable content was a Macromedia Shockwave "flash" file.
    I wanted to be able to update this file frequently as I developed it. (I also had some dynamic data files that would be changing in the same folder.) But "Refresh" on my browser (Internet Explorer 6) wouldn't refresh! **Grr!**

    So I created a .htaccess file in the folder with this directive:


    Header add Cache-Control: no-cache

    That tells IE not to cache the file; it should reload it every time instead.

    The problem was that once I did this, the file wouldn't load at all anymore. IE would open a "File download" warning box. I have a sample of it set up here (which may work fine on your browser, but it fails on my IE6 every time).

    It told me "Some files can harm your computer." And it offered to let me "Open" or "Save" the file. I clicked open. It tried to open it. It failed.

    I didn't realize the problem was my no-cache directive because I didn't really see the problem for some time after making that change.

    So I went to Google. I looked all over the place. Finally I found a mention by NickyBoy on a php tech note. He said this:


    The problems people mention about IE are actually a feature!
    Microsoft Knowledge Base Article 316431 says:

    In order for Internet Explorer to open documents in
    #电加热器 发表于2005-06-01 12:51:00  IP: 61.186.252.*
    请问session与cookie有什么区别?在功能上?
    #su 发表于2005-09-29 08:59:00  IP: 211.100.21.*
    Warning: Cannot modify header information - headers already sent by (output started at E:\tangtsingyuan\top.inc.php:59)

    请问这是什么错误?
    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © 六道