mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-30 21:29:23 +02:00
Update 02_Sessions.md
Add additional 'use' statement (for Injector) in example of getting a session outside a controller.
This commit is contained in:
parent
fc457caa6e
commit
72c5d5244f
@ -30,6 +30,7 @@ Otherwise, if you're not in a controller, get the request as a service.
|
||||
|
||||
```php
|
||||
use SilverStripe\Control\HTTPRequest;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
|
||||
$request = Injector::inst()->get(HTTPRequest::class);
|
||||
$session = $request->getSession();
|
||||
|
Loading…
Reference in New Issue
Block a user