public function SessionTestController::getId in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php \Drupal\session_test\Controller\SessionTestController::getId()
Print the current session ID.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The incoming request.
Return value
string A notification message with session ID.
1 string reference to 'SessionTestController::getId'
- session_test.routing.yml in core/
modules/ system/ tests/ modules/ session_test/ session_test.routing.yml - core/modules/system/tests/modules/session_test/session_test.routing.yml
File
- core/
modules/ system/ tests/ modules/ session_test/ src/ Controller/ SessionTestController.php, line 57 - Contains \Drupal\session_test\Controller\SessionTestController.
Class
- SessionTestController
- Controller providing page callbacks for the action admin interface.
Namespace
Drupal\session_test\ControllerCode
public function getId(Request $request) {
// Set a value in $_SESSION, so that SessionManager::save() will start
// a session.
$_SESSION['test'] = 'test';
$request
->getSession()
->save();
return [
'#markup' => 'session_id:' . session_id() . "\n",
];
}