thinkphp Error Accumulation and summary

Source: Internet
Author: User

1, illegal request: Index/user/addlist

Use two similar URLs to request two methods separately

These two methods:

Public function Add6 () {
$user [' nickname '] = "Chen Liu";
$user [' email '] = "[email protected]";
$user [' birthday '] = strtotime ("1993-12-12");
if ($result = Usermodel::create ($user)) {
return "User [". $result->nickname. ":". $result->id. "] New Success ";
}else{
return Usermodel::geterror ();
   }
  }
Public function Addlist () {
$user = new Usermodel;
$userlist = [
[' nickname ' + ' Zhou Eight ', ' email ' = ' [email protected] ', ' Birthday ' =>strtotime (' 1991-04-20 ')],
[' nickname ' + ' summer Nine ', ' email ' = ' [email protected] ', ' Birthday ' =>strtotime (' 1990-02-28 ')],
   ];
if ($user->saveall ($userlist)) {
return "User batch new success";
}else{
return "User batch add error";
   }
  }

Routing rules:


return [
' __pattern__ ' = [
' name ' = ' \w+ ',
    ],
' [Hello] ' = [
': id ' = [' Index/hello ', [' method ' = ' get '], [' id ' = ' \d+ '],
': name ' = = [' Index/hello ', [' method ' = ' post ']],
    ],
' user/index ' = ' index/user/index ',
' user/create ' = ' index/user/create ',
' user/add ' = ' index/user/add ',
' user/add_list ' = ' index/user/addlist ',
' user/update/:id ' = ' index/user/update ',
' user/delete/:id ' = ' index/user/delete ',
' user/:id ' = ' index/user/read ',
];

The Final Solution: Delete the "user/add_list" and "Index/user/addlist" in the routing rules. Although I don't know why it is wrong here.

thinkphp Error Accumulation and summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.