[2.0] getHeader() didn't work

Can not get header from request->getHeader(), but from getallheaders() is normal. I use Apache 2.4.12, PHP 5.6.7



2.4k

What exactly is your question?

$clientId = $app->request->getHeader('API_ID'); $clientId = NULL

but with $serverHeader = getallheaders(); $clientId = $serverHeader['API_ID']; This get the data.



2.4k

Which Headers do you get if you call getHeaders() ?

$allHeaders = $app->request->getHeaders();

var_dump($allHeaders);

Is your Header "API_ID" in this array list?

It's return NULL for get by getHeaders(). And yes, API_ID is in headers if get by getallheaders().

Are you using \Phalcon\DI::FactoryDefault() for your depenency injection?

If not, try

$app->getShared('request')->getHeaders();