Online Snippets Library

How to define a constant in codeIgniter.

In codeIgniter,we define constant inside /application/config/constants.php. you do not need to load constants anywhere,they are automatically loaded by CodeIgniter.

Define constant variable

define('devUrl','dev.tutsway.com'); define('webUrl','tutsway.com');

Use constant variable

if($url== webUrl) { // do some thing }

remove-index.php-from-url-in-codeigniter