As mention in the title I am trying to send the Session variables in the View Section after I login,
The Session contains let's say name and email.
So what I have tried in the Profile Controller Section is below:
class ProfileController extends Controller{
public function index()
{
$session = session();
$userDetails = ['name' => $session->get('name'),
'email' => $session->get('email')];
print_r($userDetails);
echo view('profile', $userDetails);
}
}
although I am able to print the $userDetails value in the controller Section, the same I am trying in VIEW is giving me nothing.
here's my profile.php code in view.
<h3>Welcome to the Profile Section : <?php echo $userDetails['name']; ?></h3>
<p>Your email id : <?php echo $userDetails['email'] ; ?></p>
The output I am getting is :
Please correct me if I am missing something as I am new to the PHP frameworks.
