cari

Rumah  >  Soal Jawab  >  teks badan

Baris kod $user= UserModel::create($request->param()); saya tidak tahu apa yang salah.

//添加操作
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];
}

紫轩 ADG紫轩 ADG2331 hari yang lalu2360

membalas semua(5)saya akan balas

  • You bad bad

    You bad bad2018-07-13 16:34:52

    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]

    balas
    0
  • 紫轩 ADG

    terima kasih . keanehan

    紫轩 ADG · 2018-07-14 07:07:49
  • 紫轩 ADG

    紫轩 ADG2018-07-11 17:43:15

    [0] InvalidArgumentException dalam Response.php baris 316


    1531302174739456.jpg

    ralat jenis pembolehubah: array

       {       

    ; $ this       $kandungan = $ini- >output($this->data);   

             

    jika (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([    

                                             

      ])            ) {            

        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 19

    at require('D:phptp5thinkphp...') dalam index.php baris 17

    Environment Variables

    GET Data

    /index/user/adduser_html

    Data

    POST Data

    POST

    Fail

    kosong

    Kuki

    thinkphp_show_page_trace

    0|0

    PHPSESSID

    b1e4csbk4p7etj8p50r4m90r

    { "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 Data

    PATH

    C:Windowssystem32;C:Wmys;temC:2 WindowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon

    SYSTEMROOT

    SYSTEMROOT

    Windows

    System

    32cmd.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_

    1796

    SCRIPT_NAME

    /index.php

    REQUEST_URI

    /index/user/adduser.html

    QUERY_STRING

    /index/user/adduser.html

    ODREQUEST_PR

    COL

    HTTP/1.1

    GATEWAY_INTERFACE

    CGI/1.1

    REDIRECT_QUERY_STRING

    /index/user/adduser.html

    REDIRECT_URL

    /index/user/adduser.html

    7

    SCRIPT_FILENAME

    D:/php/tp5/ public/index.php

    SERVER_ADMIN

    admin@php.cn

    CONTEXT_DOCUMENT_ROOT

    D:/php/tp5/public

    CONTEXT_PREFIX

    CONTEXT_DOCUMENT_ROOT

    D:/php/tp5/public

    CONTEXT_PREFIX

    CONTEXT_PREFIX

    CONTEXT_DOCUMENT_ROOT

    D:/php/tp5/public

    CONTEXT_PREFIX

    DOCUMENT

    DOCUMENT

    MEREQUEST

    OT

    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.8

    HTTP_USER_AGENT

    Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, seperti Gecko) Chrome/67.0.3396.37.3396.99 SOALAN

    .

    /index.php

    REQUEST_TIME_FLOAT

    1531301786.1009

    REQUEST_TIME

    1531301786 . ION

    5.0.20

    THINK_START_TIME

    1531301786.1089

    LIB_PATH

    D:phptp5thinkphplibrary

    CORE_PATH

    D:phptp5thinkphplibrarythink

    TRAIT_PATH

    D :phptp5thinkphplibrarytraits

    ROOT_PATH

    D:phptp5

    EXTEND_PATH

    D:phptp5extend

    VENDOR_PATH

    D:phptp5TIMES tp5runtime

    LOG_PATH

    D:phptp5runtimelog

    CACHE_PATH

    D:phptp5runtimecache

    TEMP_PATH

    D:phptp5runtimetemp

    CONF_PATH

    D:phptp5public/../application/

    CONF_EXT

    .php

    _

    P_FIX

    IS_CLI

    salah

    IS_MENANG

    benar

    USER_ID

    1

    ThinkPHP V5.0.20 { 十年磨一剑-为API开发设计的高性能框架 }

    05.10

    balas
    0
  • 无忌哥哥

    无忌哥哥2018-07-11 15:16:45

    Tiada ralat dilaporkan? Ini adalah pulangan ajax. Jika tiada respons, F12 untuk melihat mesej ralat

    balas
    0
  • 紫轩 ADG

    Terima kasih kerana mencari beberapa idea

    紫轩 ADG · 2018-07-11 17:44:06
  • Batalbalas