|
|
Zend Framework 2 Documentation (Manual) | |
|
File: /_sources/modules/zend.session.validator.http-user-agent.txt
Size: | 721 |
Storage flags: | no_autoload,compress/gzip (56%) |
:orphan:
.. _zend.session.validator.http-user-agent:
Http User Agent
---------------
``Zend\Session\Validator\HttpUserAgent`` provides a validator to check the session against the originally stored
$_SERVER['HTTP_USER_AGENT'] variable. Validation will fail in the event that this does not match and throws an
exception in ``Zend\Session\SessionManager`` after session_start() has been called.
Basic Usage
^^^^^^^^^^^
A basic example is one like the following:
.. code-block:: php
:linenos:
use Zend\Session\Validator\HttpUserAgent;
use Zend\Session\SessionManager;
$manager = new SessionManager();
$manager->getValidatorChain()->attach('session.validate', array(new HttpUserAgent(), 'isValid'));
For more information about the PHK package format: http://phk.tekwire.net