2016-11-09 86 views
0

我只有在服務器中出現此錯誤,localhost很好。我不明白是什麼問題。我甚至嘗試過很多解決方案,但都沒有成功。session_start():無法發送會話緩存限制器 - 已在我的服務器中發送的頭文件

這是我的看法

<form action="<?php echo base_url().'index.php/Quickaccess/index'?>" method="post" id="myform">        
         <li> 
           Select the page 
           <select id="Pages" name="Pages" class ="form-control input-sm "style="width:210px"> 
           <option value="1">Client</option> 
           <option value="2">Employee</option> 
           <option value="3">Project</option> 
           <option value="4">Task</option> 
           </select> 
           Numeric Value 

           <input type="text" name="PageID" style="width:210px" class ="form-control input-sm" id="text1" /> 
           <span id="error" style="color: Red; display: none">* Input digits (0 - 9)</span> 
           <button type="Submit" value="btnSearch" id="btnSearch" name="operation" class="btn btn-info btn-small btn-3d" > 
           <i class="fa fa-share"></i> &nbsp GO 
           </button> 



         </li> 
</form> 

這是控制器

class Quickaccess extends CI_Controller { 
public function __construct() { 
    parent::__construct(); 

} 
public function index() 
{ 

    $this->load->library('user_agent'); 

    $Pages=$this->input->post('Pages'); 
    $PageID=$this->input->post('PageID'); 
    $EmployeeID=$this->db->query("select max(EmployeeID) as EmployeeID from HREmployees;"); 
    $Employee=$EmployeeID->row('EmployeeID'); 
    $ClientID=$this->db->query("select max(ClientID) as ClientID from CRMClients;"); 
    $Client=$ClientID->row('ClientID'); 
    $ProjectID=$this->db->query("select max(ProjectID) as ProjectID from OPProjects;"); 
    $Project=$ProjectID->row('ProjectID'); 
    $ProjectTaskID=$this->db->query("select max(ProjectPlanTaskID) as ProjectPlanTaskID from OPProjectPlanTasks"); 
    $ProjectTask=$ProjectTaskID->row('ProjectTaskID'); 

    if($Pages==NULL||$PageID==NULL) 
    { 

     redirect($this->agent->referrer()); 

    } 
    else 
    { 
     if($Pages ==1 && $PageID<=$Client) 
     { 
      redirect(base_url('/Clients/ClientFullDetails/' . $PageID)); 
     } 
     elseif ($Pages ==2 && $PageID<=$Employee) 
     { 
      redirect(base_url('/Employees/Employeefulldetails/' . $PageID)); 
     } 
     elseif ($Pages ==3 && $PageID<=$Project) 
     { 
      redirect(base_url('/Projects/ProjectFullDetails/' . $PageID)); 
     } 
     elseif ($Pages ==4 && $PageID<=$ProjectTask) 
     { 
      $ProjectID=$this->db->query("Select ProjectID from OPProjectPlanTasks where ProjectPlanTaskID=".$PageID); 
      $Project=$ProjectID->row('ProjectID'); 
      redirect(base_url('/Projects/TaskFullDetails/'.$Project.'?PtID='. $PageID)); 

     } 
     else 
     { 

      redirect($this->agent->referrer()); 
     } 

    } 
} 

請告訴我一個解決方案很快

+0

就像使用session_start()一樣,即使SESSION已經啓動。 – Irvin

回答

0

「頭已經發送」意味着你的PHP腳本已經發送的HTTP頭文件,因此現在無法對其進行修改。

檢查您是否在調用session_start之前不發送任何內容。 只是讓session_start成爲你在PHP文件中做的第一件事。在的session_start開始之前,絕對是所有的HTML。

相關問題