Tema: setHeader
Ver Mensaje Individual
  #6 (permalink)  
Antiguo 24/04/2011, 04:20
Avatar de masterpuppet
masterpuppet
Software Craftsman
 
Fecha de Ingreso: enero-2008
Ubicación: Montevideo, Uruguay
Mensajes: 3.550
Antigüedad: 16 años, 3 meses
Puntos: 845
Respuesta: setHeader

mmmmmm, getallheaders te devuelve los headers del Request, para ver los del Response tenes que usar la contraparte apache_response_headers o bien header_list, y claro que te muestra los que seteas, al crear el objeto response, la propiedad headers esta vacía.

Con respecto al .ini, no hay resource para los headers, lo que podes hacer es inyectar via constructor el config con headers(al momento de instanciarlo en el Bootstrap).

Código PHP:
Ver original
  1. class Application_Plugin_Headers extends Zend_Controller_Plugin_Abstract
  2. {
  3.     protected $_options = array();
  4.  
  5.     public function __construct($options)
  6.     {
  7.         if($options instanceof Zend_Config) {
  8.             $options = $options->toArray();
  9.         }
  10.         if(!is_array($options)) {
  11.             throw new InvalidArgumentException('/***/');
  12.         }
  13.         this->setOptions($options);        
  14.     }
  15.    
  16.     public function setOptions(array $options)
  17.     {/***/}
  18.    
  19.     public function routeStartup(Zend_Controller_Request_Abstract $request)
  20.     {/***/}
  21. }

y en el Bootstrap:

Código PHP:
Ver original
  1. $config = new Zend_Config_Ini('/path/to/headers-inifile');
  2. $this->bootstrap('frontController');
  3. $front = $this->getResource('frontController');
  4. $front->registerPlugin(new Application_Plugin_Headers($config));

Saludos.
__________________
http://es.phptherightway.com/
thats us riders :)