Simpanoz
Simpanoz

Reputation: 2859

Codeigniter and $_SERVER

What is equalient of $_SERVER in codeigniter ?

Upvotes: 7

Views: 17157

Answers (4)

jjwdesign
jjwdesign

Reputation: 3322

Use the codigniter "way" for input such as $_POST and $_SERVER. CodeIgniter's input class has built in functionality to prevent XSS attacks. Using the input class will also make your code much more extendable, if for example, you wish to build in some kind of intrusion systems, such as PHP IDS.

http://codeigniter.com/user_guide/libraries/input.html

http://www.phpids.org/

The three functions are:

$this->input->post()
$this->input->cookie()
$this->input->server()

Upvotes: 3

user731322
user731322

Reputation:

I think you can use $_SERVER like they did about the "Automatic configbase url" in the "official" CodeIgniter wiki (http://codeigniter.com/wiki/Automatic_configbase_url/)

Upvotes: 2

Phil Sturgeon
Phil Sturgeon

Reputation: 30766

Réjôme is spot on, but remember that $_SERVER still works fine.

Upvotes: 8

Réjôme
Réjôme

Reputation: 1484

$this->input->server()

For more information, please refer to the User Guide : Input

Upvotes: 27

Related Questions