variable type error: array

来源:5-7 修改状态

SystemError

2017-07-09

老师,各位大神,我想问个问题,

 // 修改状态

    public function status() {

        $data = input('get.');

        $validate = validate('Category');

        if (!$validate->scene('status')->check($data)) {

            $this->error($validate->getError());

        }


        $res = $this->obj->save(['status' => $data['status']], ['id' => $data['id']]);

        if ($res) {

            $this->result('状态更新成功');

        } else {

            $this->result('状态更新失败');

        }

    }

在更新状态的地方,状态可以更新成功,$res的值也是1,

$this->result的地方出错.页面刷新后报这个错误

[0] InvalidArgumentException in Response.php line 315

variable type error: array

    {

        if (null == $this->content) {

            $content = $this->output($this->data);


            if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([

                $content,

                '__toString',

            ])

            ) {

                throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content)));

            }


            $this->content = (string) $content;

        }

        return $this->content;

    }


    /**

     * 获取状态码

Call Stack

in Response.php line 315

at Response->getContent() in Response.php line 93

at Response->send() in start.php line 18

有人遇到吗?


写回答

1回答

singwa

2017-07-09

你好,请使用下面的

$this->success('更新成功');

$this->error('更新失败');


0
0

Thinkphp5.0仿百度糯米开发多商家电商平台

【毕设】BAT大牛亲授ThinkPHP 5.0,实战中学透新技能,应用于工作

2439 学习 · 1712 问题

查看课程