字体:  

PHP session与UTF-8的问题

efoison 发表于: 2008-9-09 16:03 来源: 编程吧

  原文:http://blog.ajneok.org/2007/11/04/php-session-tip/
1.session檔案的儲存路徑:
可以在 php.ini 的 session.save_path 更改

2.session_start(); 之前不能有ouput的動作

3.如果遇到下面這串的話:
    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (xxxxxxxx) in xxxxxxxx
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (xxxxxxxx) in xxxxxxxx

這個原因這次困擾我最久= =
原來是因為有些UTF-8格式的檔案會在文件開頭的地方放上判斷字元
所以只要在php.ini裡面把
    output_buffering = Off

改成
    output_buffering=4096