donglaoe2979 2016-10-28 05:11
浏览 43
已采纳

CodeIgniter:致命错误:无法在写上下文中使用方法返回值

I have this issue where I am posting a response into the controller, however it throws this error. This is the first time I am coming across this error.

Kindly find the code below:

    if (isset($this->input->post('responseCode'))) 
       {
         echo '<p><strong>Cardstream Response</strong></p>';
         echo '<pre>';
         print_r($this->input->post());
         echo '</pre>';
       }

It is pointing at this particular line if (isset($this->input->post('responseCode')))

This is a cardstream integration. Unfortunately I haven't found the library for cardstream in codeigniter, hence I am using the Core PHP code for the same.

Any help will be greatly appreciated. Thanks.

  • 写回答

3条回答 默认 最新

  • dongxu8533486 2016-10-28 05:16
    关注

    You are using isset() on a method, which presumably returns a expression result. You cannot do that because isset() is only used on variables. Try checking if it's null instead:

    if ($this->input->post('responseCode') !== null) {...
    

    Or simply:

    if ($this->input->post('responseCode')) {...
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 dev运行环境,c语言,报错是为什么?怎么改
  • ¥15 如何解决蓝牙通话音频突发失真问题
  • ¥15 安装opengauss数据库报错
  • ¥15 【急】在线问答CNC雕刻机的电子电路与编程
  • ¥60 在mc68335芯片上移植ucos ii 的成功工程文件
  • ¥15 笔记本外接显示器正常,但是笔记本屏幕黑屏
  • ¥15 Python pandas
  • ¥15 蓝牙硬件,可以用哪几种方法控制手机点击和滑动
  • ¥15 生物医学数据分析。基础课程就v经常唱课程舅成牛逼
  • ¥15 云环境云开发云函数对接微信商户中的分账功能