我调用success函数出错,搞了办半天也没明白,高手看看???用的是thinkphp5.0

新手上路,请多包涵

我执行这个函数
public function index()

{
    $add='add';
    return ($this->success('dsfafdadfs',$add));
}

结果就报这个错误,没道理呀?我也看了详细看了success这个函数原型,可以带5个变量,总说变量类型错误,什么原因呀,郁闷中.............
[0] InvalidArgumentException in Response.php line 312
variable type error: array

 * 获取输出数据
 * @return mixed
 */
public function getContent()
{
    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 312
at Response->getContent() in Response.php line 94
at Response->send() in start.php line 19
at require('D:1phpwwwroottest...') in index.php line 17### 问题描述

问题出现的环境背景及自己尝试过哪些方法

相关代码

// 请把代码文本粘贴到下方(请勿用图片代替代码)

你期待的结果是什么?实际看到的错误信息又是什么?

阅读 2.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题