PHP - session_start
Trieda
Metóda - session_start
(PHP 4, PHP 5, PHP 7)
This function creates a session environment.
Note!
- If you are using a cookie-based session, you must call
session_start()before you start working with it. - This function sends multiple HTTP headers. If you want to change it, call
the
session_cache_limiter()function.
Procedurálne
- function session_start (array $options = []) : bool
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $options | array | [] | If availaible, this is an associative array of options that overrides the default session settings. You shouldn't use the "session" prefix in the keys. |
Mávratovej hodnoty
Vracia: bool
On error returns false, true otherwise.
Príklady
<?php
// We will start sessions
session_start();
// Now we can work with them
$_SESSION["Username"] = "admin";
$_SESSION["Password"] = "ITnetwork";
echo ("User: " . $_SESSION["Username"]);
echo ("Password: " . $_SESSION["Password"]);
Súvisiace manuály
- function session_id (string $id) : string
