//新增動作
public function addUser(Request $request)
{
$data = $request -> param();
$status = 1;
$message = '新增成功';
$rule = [
'name|使用者名稱' => "require|min:3|max:10",
; "require|min:3|max:10",
'email|信箱' => 'require|email'
];
$result = $this -> validate( $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 100 如果# }
return ['status'=>$status, 'message'=>$message];
}
#
You bad bad2018-07-13 16:34:52
你的 return ['status'=>$status, 'message'=>$message]; 。不是應該用assign()嗎。還有目測是資料型態錯誤。把你的資料變數例如$data加個[0]。 。 。 $data[0]輸出看看
紫轩 ADG2018-07-11 17:43:15
[0] InvalidArgumentException in Response.php line 316
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([ '__toString ', ]) ) {
## ) 錯誤中與變數 } $this->content = (string) $content; } return $this->content; } /** * 取得狀態碼
Call Stack
in Response.php line 316
b1e4csbk4p7etj8p50l4m9r0r6Sessionthink{ "user_id": 1, "user_info": { "id": 1, "name": "admin", “密碼”:“e10adc3949ba59abbe56e057f20f883e”,“電子郵件”:“admin123@php.cn”,“角色”:1,“狀態”:1,“創建時間”:1501493848,“更新時間”:153 ,「刪除時間」:空, "login_time": 1531298973, "login_count": 23, "is_delete": 1 } }
##伺服器/請求資料
PATH
C:\Windows\system32;C :\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C: \Program Files\Common Files\Intel \WirelessCommon\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\
SYSTEMROOT
#C:\Windows
COMSPEC
C:\Windows\system32\cmd.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
#_FCGI_SHUTDOWN_EVENT_#1796##_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_ADMINadmin@php。 cnCONTEXT_DOCUMENT_ROOTD:/php/tp5/publicCONTEXT_PREFIXREQUEST_SCHEMEhttp##DOCUMENT_ROOT
D:/php/tp5/public
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=
##HTTP_COOKIEthinkphp_show_page_trace=0| 0; PHPSESSID=b1e4csbk4p7etj8p50l4m9r0r6; thinkphp_show_page_trace=0|0HTTP_ACCEPT_LANGUAGEzh-CN,zh;q=0.9HTTP_ACCEPT_ENCODINGgzip, deflate##HTTP_ACCEPT_ENCODING##gzip, deflate##Pm#PM
文字/html,應用程式/xhtml+xml,應用程式/xml;q=0.9,圖片/webp,圖片/apng,*/*;q=0.8
HTTP_USER_AGENT
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36(KHTML,如Gecko) Chrome/67.0.3396.99 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS
#111414 月closeHTTP_HOSTwww.tp5.cnREDIRECT_STATUS#200#FCGI_ROLE#回應者PHP_SELF/index.phpREQUEST_TIME_FLOAT1531301786.1009#REQUEST_TIME1531301786PATH_INFO/index/user/adduser.html環境變數空白ThinkPHP常數#APP_PATHD:\php\tp5\public/../application/THINK_VERSION5.0.20THINK_START_TIME#1531301786.1089
THINK_START_MEM144840EXT.phpDS\THINK_PATH
D:\php\tp5\thinkphp\LIB_PATHD:\php\tp5\thinkphp\library\#CORE_PATH#D :\php\tp5\thinkphp\library\think\TRAIT_PATHD:\php\tp5\thinkphp\library\traits\ROOT_PATH #D:\php\tp5\EXTEND_PATHD:\php\tp5\extend\VENDOR_PATH#D:\ php\tp5\供應商\RUNTIME_PATHD:\php\tp5\runtime\LOG_PATH
##D:\php\tp5\runtime \log\
CACHE_PATH
D:\php\tp5\runtime\cache\
TEMP_PATH
D:\php\tp5\runtime\temp \
CONF_PATH
D:\php\tp5\public/../application/
CONF_EXT
.php
#ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
true
USER_ID
#1
ThinkPHP V5.0.20 { 十年磨一劍-為API開發設計的效能框架 }
0.103005s