//添加操작
공용 함수 addUser(요청 $request)
{
$data = $request -> param();
$status = 1;
$message = '添加成功';
$rule = [
'name|용户명' => "require|min:3|max:10",
'password|密码' => "require|min:3|max:10",
'이메일|邮箱' => 'require|email'
];
$result = $this -> verify($data, $rule);
//return ['status'=>$status, 'message'=> $result ];
if ($result === true) {
// return ['status'=>$status, 'message'=>$request->param()];
$user= UserModel::create($request->param());
if ($user === null) {
$status = 0;
$message = '添加失败~~';
}
}
return ['status'=>$status, 'message'=>$message];
}
귀하의 반품 ['status'=>$status, 'message'=>$message]; 할당()을 사용하면 안 되나요? 데이터 유형 오류를 육안으로 검사하는 방법도 있습니다. $data와 같은 데이터 변수에 [0]을 추가합니다. . . $data[0]
의 출력을 살펴보세요🎜[0] Response.php 라인 316
변수 유형 오류의 InvalidArgumentException: array
{
if (null == $this->content) {
$content = $this- >출력($this->data);
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
$content, '__toString',
]) ) {
새로 던지기 InvalidArgumentException(sprintf('변수 유형 오류: %s', gettype($content)));
} $this->content = (문자열) $content; }
return $this->content; }/******
call stack
in response.php line 316 at response- & gt; getContent () at response.php line 94 at response- & gt; send () start.php 19행
에서 require('D:phptp5thinkphp...') index.php 17행
환경 변수
GET Data
/index/user/adduser_html
POST Data
empty
파일
empty
Cookies
thinkphp_show_page_trace
0|0
PHPSESSID
b1e4csbk4p7etj8p50l4m9r0r6
Session
think
{ "user_id": 1, "user_info": { "id": 1, "이름 ": "admin", "password": "e10adc3949ba59abbe56e057f20f883e", "email": "admin123@php.cn", "role": 1, "status": 1, "create_time": 1501493848, "update_time": 1531298974, "delete_time": null, "login_time": 1531298973, "login_count": 23, "is_delete": 1 } }
서버/요청 데이터
PATH
C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C: WindowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon
SYSTEMROOT
C:Windows
COMSPEC
C:Windowssystem32cmd.exe
PATHEXT
.COM ;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
WINDIR
C:Windows
PHP_FCGI_MAX_REQUESTS
1000
PHPRC
C :/myphp_www/PHPTutorial/php/php-5.6.27-nts/
_FCGI_SHUTDOWN_EVENT_
1796
SCRIPT_NAME
/index.php
REQUEST_URI
/index/user/adduser.html
QUERY_STRING
/index/user/adduser.html
REQUEST_METHOD
GET
SERVER_PROTOCOL
HTTP/1.1
GATEWAY_INTERFACE
CGI/1.1
REDIRECT_QUERY_STRING
/index/user/adduser.html
REDIRECT_URL
/index/user/adduser.html
REMOTE_PORT
51873
SCRIPT _FILENAME
D:/php/tp5/ public/index.php
SERVER_ADMIN
admin@php.cn
CONTEXT_DOCUMENT_ROOT
D:/php/tp5/public
CONTEXT_PREFIX
REQUEST_SCHEME
http
DOCUMENT_ROOT
D:/php/tp5/공개
REMOTE_ADDR
127.0.0.1
SERVER_PORT
80
SERVER_ADDR
127.0.0.1
SERVER_NAME
www.tp5.cn
SERVER _SOFTWARE
Apache/2.4.23 (Win32) OpenSSL/1.0.2j mod_fcgid/2.3.9
SERVER_SIGNATURE
SystemRoot
C:Windows
HTTP_COOKIE
thinkphp_show_page_trace=0|0; PHPSESSID=b1e4csbk4p7etj8p50l4m9r0r6; thinkphp_show_page_trace=0|0
HTTP_ACCEPT_LANGUAGE
zh-CN,zh;q=0.9
HTTP_ACCEPT_ENCODING
gzip, deflate
HTTP_ACCEPT
text/html,application/xhtml+xml,application/xml;q= 0.9, image/webp,image/apng,*/*;q=0.8
HTTP_USER_AGENT
Mozilla/5.0(Windows NT 6.1) AppleWebKit/537.36(KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS
1
HTTP_CONNECTION
close
HTTP_HOST
www.tp5.cn
REDIRECT_STATUS
200
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1531301786.1009
REQUEST_TIME
1531301786
PATH_INFO
/index/user/adduser.html
환경 변수
empty
ThinkPHP 상수
APP_PATH
D:phptp5public/../application/
THINK_VERSION
5.0.20
THINK_START_TIME
1531301786.1089
THINK_START_MEM
144840
EXT
.php
DS
THINK_PATH
D:phptp5thinkphp
LIB_PATH
D:phptp5thinkphplibrary
CORE_PATH
D:phptp5thinkphplibrarythink
TRAIT_PATH
D :phptp5thinkphplibrarytraits
ROOT_PATH
D:phptp5
EXTEND_PATH
D:phptp5extend
VENDOR_PATH
D:phptp5vendor
RUNTIME_PATH
D:phptp5runtime
LOG_PATH
D:phptp5runtimelog
CACHE_PATH
D:phptp5runtimecache
TEMP_PATH
D:phptp5runtimetemp
CONF_PATH
D:phptp5public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_ CLI
false
IS_WIN
true
USER_ID
1
ThinkPHP V5.0.20 { 十年磨一剑-为API开发设计性能框架 }
0.103005s
오류가 보고되지 않았나요? 응답이 없으면 F12를 눌러 오류 메시지를 확인하세요.