php显示非法数据对象,thinkphp 非法数据对象

add($data = '', $options = array(), $replace = false)

错误原因:$this->data为空并且参数$data为空

if (empty($data)) {

// 没有传递数据,获取当前数据对象的值

if (!empty($this->data)) {

$data = $this->data;

// 重置数据

$this->data = array();

} else {

$this->error = L('_DATA_TYPE_INVALID_');

return false;

}

}

addAll($dataList, $options = array(), $replace = false)

错误原因:参数$dataList为空

if (empty($dataList)) {

$this->error = L('_DATA_TYPE_INVALID_');

return false;

}

save($data = '', $options = array())

错误原因:$this->data为空并且参数$data为空

if (empty($data)) {

// 没有传递数据,获取当前数据对象的值

if (!empty($this->data)) {

$data = $this->data;

// 重置数据

$this->data = array();

} else {

$this->error = L('_DATA_TYPE_INVALID_');

return false;

}

}

create($data = '', $type = '')

错误原因:参数$data为空并且$_POST也为空时  或者 $data不是数组

// 如果没有传值默认取POST数据

if (empty($data)) {

$data = I('post.');

} elseif (is_object($data)) {

$data = get_object_vars($data);

}

// 验证数据

if (empty($data) || !is_array($data)) {

$this->error = L('_DATA_TYPE_INVALID_');

return false;

}

data($data = '')

错误原因:参数$data不是object、string、array类型

if ('' === $data && !empty($this->data)) {

return $this->data;

}

if (is_object($data)) {

$data = get_object_vars($data);

} elseif (is_string($data)) {

parse_str($data, $data);

} elseif (!is_array($data)) {

E(L('_DATA_TYPE_INVALID_'));

}

union($union, $all = false)

错误原因:参数$union不是object、string、array类型

if (is_object($union)) {

$union = get_object_vars($union);

}

// 转换union表达式

if (is_string($union)) {

$options = $union;

} elseif (is_array($union)) {

if (isset($union[0])) {

$this->options['union'] = array_merge($this->options['union'], $union);

return $this;

} else {

$options = $union;

}

} else {

E(L('_DATA_TYPE_INVALID_'));

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值