2014-10-31 15 views

risposta

20

non ho mai usato CodeIgniter, ma per questo controllo il $_SERVER['REQUEST_METHOD'].

Guardando the docs forse qualcosa di simile:

if ($this->input->server('REQUEST_METHOD') == 'GET') 
    //its a get 
else if ($this->input->server('REQUEST_METHOD') == 'POST') 
    //its a post 

se avete intenzione di usarlo alot poi la sua semplice per rotolare la propria funzione isGet() per esso.

3

Per CodeIgniter 3 utenti: the docs state la classe di ingresso ha una funzione per ottenere il metodo di richiesta:

echo $this->input->method(TRUE); // Outputs: POST 
echo $this->input->method(FALSE); // Outputs: post 
echo $this->input->method(); // Outputs: post 
+1

Vale la pena notare questa è una caratteristica CI3 e non funzionerà in CI2. – JamesNZ

+0

Ho aggiornato la risposta –

Problemi correlati