Passing Data from Controller to View — a practical guide to CodeIgniter pass data to view with clear examples you can reuse in real projects.
CodeIgniter Tutorial Series (14/74). Prefer one article? Read the complete CodeIgniter tutorial.
Short description
Pass an associative array as the second argument to `view()`. Keys become variables inside the view.
Controller → view data
return view('welcome', [
'title' => 'Home',
'user' => 'Imtiyaj',
]);
// welcome.php
// <h1><?= esc($title) ?></h1>