I am learning MVC based web pages in php.I have few php files with multiple classes & methods in MVC layers.I have many variables & large arrays that need to be accessed in several files.some sample given below:
$label = array("lng"=>Language",tlabel"=>"Title",
"content"=>"Details", "tm"=>"Date",
"authr"=>"Post By");
$route_url;
$database;
$navbar_text;
$footer_text;
I saw few php example about using php keyword global
. But using it in many parts of the code will become
very messy to keep track.I also saw another technique where every common things goes inside a special class
called Config
like given below:
// does it need auto load? i don't know
class Config
{
public static $label = array("lng"=>Language","tlabel"=>"Title",
"content"=>"Details", "tm"=>"Date",
"authr"=>"Post By");
public static $route_url;
public static $database;
public static $navbar_text;
public static $footer_text;
}
echo SmtpConfig::$label["tlabel"];
So, please suggest the correct way in which MVC web developer do such things.Thanks