-2

This is my path.$t is my variable which holds the path.one time change want to reflect everywhere ??

$t="/var/www/upload/videos_comm/";
vaibhav kulkarni
  • 1,733
  • 14
  • 20

2 Answers2

2

You can use the file in /application/config called constants.php. You can use that file to declare your global variable.

Or you can use define as Pankucins suggested like this:

<?php
define("CONSTANT", "Hello world.");
echo CONSTANT; // outputs "Hello world."
echo Constant; // outputs "Constant" and issues a notice.

define("GREETING", "Hello you.", true);
echo GREETING; // outputs "Hello you."
echo Greeting; // outputs "Hello you."

?>
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
0

The best place to declare global variable in codeigniter is the constants.php file in the directory /application/config

You can define your global variable as follows

/**
 * Custom definitions
 */
define('first_custom_variable', 'thisisit');
$yourglobalvariable = 'thisisimyglobalvariable';
Mad Angle
  • 2,347
  • 1
  • 15
  • 33