Monday, 15 August 2011

How to get header values in Module.php? -


I am using Zend-Framework 2 and I request headers in module for authentication I want to reach the objective. How can I get a header in module.php

I have tried to do all of this

$ code = $ headers = $ this- & Gt; GetRequest () - & gt; GetHeaders (); $ Header = $ this- & gt; GetRequest () - & gt; GetHeader ('userId'); $ Header = $ this- & gt; GetRequest () - & gt; User ID; $ Header = $ _SERVER ['HTTP_LOGIN']; I have also tried to do this

  $ headers = apache_request_headers ();  

It is working but I need something else to get it into module.php Thank you ..

A very dirty solution to show you just how to get access to your request headers But do not advise adding authorization.

  Public functions on the bootstrap (MvcEvent $ event) {$ headers = $ event- & gt; GetRequest () - & gt; GetHeaders (); Var_dump ($ header); }  

I would like to suggest adding an audience to my EventManager at event code MvcEvent :: EVENT_ROUTE and take it from there Would like to

You can easily drag request objects from your MvcEvent inside your custom authentication to the getRequest () method Can listeners. Attach an audience by clicking

Event Manager .


No comments:

Post a Comment