post参数
提交的时候出现500错误 提示:variable type error:array
解决方法
//error:variable type error:array
$this->request->post('option')
//改为
$this->request->post('option/a')
/x 来源
//think\Reuqest line:701
if (is_array($name)) {
$this->param = [];
return $this->post = array_merge($this->post, $name);
}
return $this->input($this->post, $name, $default, $filter);
//think\Reuqest line:984
// 解析name
if (strpos($name, '/')) {
list($name, $type) = explode('/', $name);
} else {
$type = 's';
}
//line:1014 类型转换
if (isset($type) && $data !== $default) {
// 强制类型转换
$this->typeCast($data, $type); //typeCast就是类型转换函数
}
支持类型
/a 数组
/d 数字
/f 浮点
/b 布尔
/s 字符
本文由 程序哩 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Jan 11, 2019 at 12:06 pm