php8.5
Home/ Manual/ yaf / yaf_session/ Yaf_Session::start

Yaf_Session::start

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Start the session

Description

Yaf_Session::start(): Yaf_Session

Starts the session if it has not been started yet. This calls PHP's native session start mechanism. Calling this method multiple times is safe.

Parameters Parameters

Return Values

Returns the Yaf_Session instance.

Examples

Yaf_Session::start example

php
<?php
// typically done once per request, e.g. in a bootstrap
$session = Yaf_Session::getInstance();
$session->start();

$session->set("user_id", 42);
echo $session->get("user_id");
?>

See Also

  • Yaf_Session::getInstance

Source: reference/yaf/yaf_session/start.xml · from the official PHP manual (php/doc-en)