How to send a variable from index to controller in opencart
I want to set a variable in index.php and want 开发者_如何学编程to access that variable in any controller of open cart.
I think what you are looking for is a session variable.
$_SESSION['your Variable'] = "variable value";
this way you can set it.
You can get it by accessing.
$var_value = $_SESSION['your Variable']
i got it we can achieve this by declaring a public variable in controller.php in system/engine/controller.php and then u can access this variable in any controller by simply doing
$this->variable_name = 'foo';
精彩评论