[PHP] Cannot send session cache limiter 的解決方法
在練習架設網站時,發生了奇怪的訊息
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
後來才發現,UTF-8編碼格式的檔案,
使用記事本去開所產生,
後改用 UltraEdit 重新編輯存檔即解決了。
發生原因
session_start() 之前不能有任何字元輸出,
UTF-8 編碼裡的 BOM 也會被認為是 headers,
有上面所列狀況時 Session 將無法順利傳遞,並會顯示錯誤訊息。
解決辦法
1. 先確定<?php 和 session_start() 之間沒有其他字元,而且空格也要移除。
2. 若是 UTF-8 編碼,則用編輯器(例 UltraEdit、Notepad++...)來修改,並將檔案裡的 BOM 移除。
[PHP] Cannot send session cache limiter 的解決方法
http://drvcity.blogspot.com/2013/02/phpcannot-send-session-cache-limiter.html
沒有留言:
張貼留言