//添加操作
fungsi awam addUser(Minta $request)
{
$data = $request -> param();
$status = 1;
$message = '添加成功';
$rule = [
'name|用户名' => "memerlukan|min:3|maks:10",
'kata laluan|密码' => "memerlukan|min:3|maks:10",
'e-mel|邮箱' => 'memerlukan|e-mel'
];
$hasil = $ini -> validate($data, $rule);
//return ['status'=>$status, 'message'=> $result ];
if ($result === true) {
// kembali ['status'=>$status, 'message'=>$request->param()];
$user= UserModel::create($request->param());
if ($user === null) {
$status = 0;
;~mess }
}
kembalikan ['status'=>$status, 'message'=>$message];
}
Pemulangan anda ['status'=>$status, 'message'=>$message] . Tidak sepatutnya assign() digunakan? Terdapat juga pemeriksaan visual ralat jenis data. Tambahkan [0] pada pembolehubah data anda seperti $data. . . Lihat pada output $data[0]
[0] InvalidArgumentException dalam Response.php baris 316
ralat jenis pembolehubah: array
{
; $ this $kandungan = $ini- >output($this->data);
]) ) {
buang baru InvalidArgumentException(sprintf('ralat jenis pembolehubah: %s', gettype($content)));
} $ini->kandungan = (rentetan) $kandungan; }
kembali $ini->kandungan; } /** * 获取状态码
Call Stack
dalam Response.php baris 316
at Response->dalam getRespons
t;hantar() dalam start.php baris 19at require('D:phptp5thinkphp...') dalam index.php baris 17Environment VariablesGET Data/index/user/adduser_htmlData
POST Data
POST
FailkosongKukithinkphp_show_page_trace0|0PHPSESSIDb1e4csbk4p7etj8p50r4m90r { "user_id": 1, "user_info": { "id": 1, "name ": "admin", "password": "e10adc3949ba59abbe56e057f20f883e", "email": "admin123@php.cn", "role": 1, "status": 1, "create_time": 1501493848, "update_time" "delete_time": null, "login_time": 1531298973, "login_count": 23, "is_delete": 1 } }Server/Request DataPATHC:Windowssystem32;C:Wmys;temC:2 WindowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommonSYSTEMROOTSYSTEMROOTWindows
System32cmd.exe
PATHEXT
.COM ;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
WINDIR
C:Windows
PHP_FCGI_MAX_REQUESTS
100
C :/myphp_www/PHPTutorial/php/php-5.6.27-nts/_FCGI_SHUTDOWN_EVENT_1796SCRIPT_NAME
/index.php
REQUEST_URI
/index/user/adduser.html
QUERY_STRING
/index/user/adduser.html
ODREQUEST_PR
COLHTTP/1.1 GATEWAY_INTERFACECGI/1.1REDIRECT_QUERY_STRING/index/user/adduser.htmlREDIRECT_URL/index/user/adduser.html 7OT
D:/php/tp5/public . _PERISIAN
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, kempiskan
HTTP_application/html
;q=0.9, image/webp,image/apng,*/*;q=0.8HTTP_USER_AGENTMozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, seperti Gecko) Chrome/67.0.3396.37.3396.99 SOALAN . /index.phpREQUEST_TIME_FLOAT1531301786.1009REQUEST_TIME1531301786 . ION5.0.20THINK_START_TIME1531301786.1089
LIB_PATHD:phptp5thinkphplibraryCORE_PATHD:phptp5thinkphplibrarythinkTRAIT_PATHD :phptp5thinkphplibrarytraitsROOT_PATHD:phptp5EXTEND_PATH D:phptp5extendVENDOR_PATHD:phptp5TIMES tp5runtimeLOG_PATHD:phptp5runtimelogCACHE_PATHD:phptp5runtimecache TEMP_PATHD:phptp5runtimetempCONF_PATHD:phptp5public/../application/CONF_EXT.php_
P_FIXIS_CLI
salah
IS_MENANG
benar
USER_ID
1
ThinkPHP V5.0.20 { 十年磨一剑-为API开发设计的高性能框架 }
05.10
Tiada ralat dilaporkan? Ini adalah pulangan ajax. Jika tiada respons, F12 untuk melihat mesej ralat