PHP錯誤-Warning: session_start(): Cannot start session when headers already sent in

那表示你在呼叫函式 session_start 或 header 前,就有輸出網頁內容了。這兩個函式都必須在輸出任何網頁內容前呼叫,所以把這兩個函式移到輸出網頁內容前就可以了。

1.Notice: Undefined index: action 有錯誤不行

2.有echo也不行

<?php 
  echo '我是echo'; 
  session_start(); 
?>
請改成︰

<?php 
  session_start(); 
  echo '我是echo'; 
?>

解決方法一樣是把 session_start 移到上面。

期待您的留言

Comments

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *