drd0833 2018-01-22 16:31 采纳率: 100%
浏览 74

没有得到http请求自定义标头

I am setting http headers in angular js interceptor to make a http request but on php end not getting header.

   var key = sessionStorage.getItem('user_type');
            //for app version
            config.headers['AppVersion'] = '1.0';
            config.headers['language'] = web_language;
            if(key == null)
            {
                if(localStorage.getItem('user_type'))
                {
                    config.headers['user_type'] = localStorage.getItem('user_type');
                }
                else
                {
                    config.headers['user_type'] = '';   
                }
            }
            else 
            {
                config.headers['user_type'] = key;
            }
            return config;

In browser in network tab in headers i can see the user_type value sent in request.

In php I am using codeigniter:-

$user_type = $this->input->get_request_header('user_type');

I want to fetch user_type header in php end but not getting. I am using the linux redhat server godaddy hosting.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 vmware exsi重置后登不上
    • ¥15 易盾点选的cb参数怎么解啊
    • ¥15 MATLAB运行显示错误,如何解决?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
    • ¥20 yolov5自定义Prune报错,如何解决?
    • ¥15 电磁场的matlab仿真
    • ¥15 mars2d在vue3中的引入问题
    • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面