note 127116 added to session.examples.basic
| From: | michi40gan at hotmail dot com | Date: | Thu, 19 May 2022 15:52:05 +0000 |
| Subject: | note 127116 added to session.examples.basic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218494@lists.php.net to get a copy of this message | ||
La función session_start() no sólo es necesaria para iniciar la sesión y poder acceder e
inicializar $_SESSION por primera vez.
TODOS los archivos que vayan a intentan acceder o modificar alguna variable almacenada en la array
$_SESSION deben empezar el archivo php con:
<?php
session_start();
Es decir, para acceder a un
echo $_SESSION['user']
o para
$_SESSION['user'] = 'new_user'
antes el archivo .php debe haber empezado con session_start() o devolverá un error tipo:
Undefined variable _SESSION
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.47 (proxied: 2a0c:5a80:3f03:8500:6c0b:80c3:988f:326b)
----
Manual Page -- https://php.net/manual/en/session.examples.basic.php
Edit -- https://main.php.net/note/edit/127116
Del: integrated -- https://main.php.net/note/delete/127116/integrated
Del: useless -- https://main.php.net/note/delete/127116/useless
Del: bad code -- https://main.php.net/note/delete/127116/bad+code
Del: spam -- https://main.php.net/note/delete/127116/spam
Del: non-english -- https://main.php.net/note/delete/127116/non-english
Del: in docs -- https://main.php.net/note/delete/127116/in+docs
Del: other reasons-- https://main.php.net/note/delete/127116
Reject -- https://main.php.net/note/reject/127116
Search -- https://main.php.net/manage/user-notes.php