V
V
Vasya Borisevich2018-06-06 08:27:23
PHP
Vasya Borisevich, 2018-06-06 08:27:23

How to select value from session?

Hello. How to get a value from the session, if with such a request

<?php
  session_start();
  $t1 = $_SESSION["user"];
  echo $t1;
?>

we get the following response:
a:5:{s:2:"id";s:1:"1";s:8:"username";s:5:"admin";s:8:"password";s :32:"
058cb479ac32075b964n25252d234b70 ";s:10:"specialist";s:1:"1";s:9:"branch_id";s:1:"1 " ; } since it is the fifth character in a row. Z.Y. I didn't write the session entry code, so I'm asking for your help. $t1 = $_SESSION["user"][4];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-06-06
@ki11k4

it is serialized data. use php.net/manual/ru/function.unserialize.php to turn them into a familiar look.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question