开发者

PHP HttpRequest::setHeaders() converting my header names to camel case

I need to send the following header with my httpRequest:

'X-ABC-Reco-Token'=>'a0d15977'开发者_C百科;

I have the following code:


            $array = array("X-ABC-Reco-Token"=>$token);
            $this->request->setHeaders($array);
            echo var_dump($this->request->getHeaders());

however, this is the output I get:

 "X-Abc-Reco-Token"=>string 'a0d15977' 

Note that PHP converted X-ABC to X-Abc.

Is there a way I can force the header to be the case I want?


In worst case, you can make own class and inherit from httpRequest, then overload setHeaders function and make it work as you want. But you will need source code of that class to do this.

Other method in my mind is inherit from httpRequest and add a method like "fix()", which would set property of class where http request is waiting (maybe "queryData" ? - see http://www.php.net/manual/pl/class.httprequest.php) in your way by str_replace() Abc to ABC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜