解决 TP6 -------Array to string conversion
作者:互联网
首先看到“Array to string conversion”这一串我惊呆了,前段时间调试代码的时候还是好好的。
具体产生的原因可能就是用的如下代码
//param接受请求url中的参数
$username = $this->request->param("username","","trim");
$email= $this->request->param("email","","trim");
$password= $this->request->param("password","","trim");
$repassword= $this->request->param("repassword","","trim");
//后来我发现我每次用param接受数据为空,可能就是没有获取到url中的参数
//于是改为如下
$username = input("username","","trim");
$email= $input("email","","trim");
$password= input("password","","trim");
$repassword= input("repassword","","trim");
//咋一看没啥问题,结果忘了input和param第一个参数不一样
//input中第一个参数是key,param第一个参数传的是name
//而且Array to string conversion 的是数组转换成字符串
//所以问题就是在这
//需要改为如下
$username = input("username","");
$email= $input("email","");
$password= input("password","");
$repassword= input("repassword","");
问题就成功解决
遇到这种问题我也是第一次遇到,所以一开始脑瓜子嗡嗡的
标签:trim,username,conversion,string,param,-------,repassword,input,email 来源: https://blog.csdn.net/qq_17525509/article/details/120619691