CI_Loader::vars()

vars($vars[, $val = ''])

Parameters:
  • $vars (mixed) – An array of variables or a single variable name
  • $val (mixed) – Optional variable value
Returns:

CI_Loader instance (method chaining)

Return type:

CI_Loader

This method takes an associative array as input and generates variables using the PHP extract() function. This method produces the same result as using the second parameter of the $this->load->view() method above. The reason you might want to use this method independently is if you would like to set some global variables in the constructor of your controller and have them become available in any view file loaded from any method. You can have multiple calls to this method. The data get cached and merged into one array for conversion to variables.

doc_CodeIgniter
2016-10-15 16:31:46
Comments
Leave a Comment

Please login to continue.