search

Home  >  Q&A  >  body text

php - laravel HTTP request question, the meaning of put patch delete options, what are the application scenarios

What is the use of HTTP request type, put patch delete options? Never used it.
Usually, development requires get post requests, and I feel that get post can completely perform MySQL addition, deletion, modification, and query operations.
What are the uses of these types of put patch delete options? What are the application scenarios? How should I write it?
Get requests usually use URL to pass parameters, and the form method can also be written as get;
Post requests usually use form submission;

PHP中文网PHP中文网2822 days ago1048

reply all(6)I'll reply

  • 巴扎黑

    巴扎黑2017-05-16 13:08:12

    These are standard http predicates

    • GET Get resources

    • POST Create Resource

    • PUT edit/update resources (complete resource fields need to be submitted)

    • PATCH edit/update resources (you can submit fields that need to be updated)

    • DELETE Delete resources

    • OPTIONS Which request verbs are allowed by the server

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 13:08:12

    These are commonly used in the recently popular RestFul mode. In addition, HTML forms only support two request methods: POST and GET. PUT, PATCH and DELETE are fake HTTP request methods in Laravel. You need to add <input type="hidden" name="_method" value="PUT(PATCH、DELETE)"> to the form to take effect. Also Configure routing.

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-16 13:08:12

    http://www.imooc.com/learn/81...

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 13:08:12

    In fact, it is recommended to read "HTTP Authoritative Guide" and other similar books explaining HTTP to understand HTTP
    You need to understand a few concepts,
    1. These put and delete methods are not unique to laravel. In fact, all PHP frameworks should support it Of course, these frameworks do not support it. As mentioned in the question, GET and POST can satisfy the business
    2. It is not unique to PHP. Any language that deals with HTTP should support it

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:08:12

    Search Restful and you will understand.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 13:08:12

    Get and post can of course satisfy all operations.
    Using put, patch and delete makes it look simpler and easier to understand.
    patch /item/1 is to modify the data with id 1.
    get /item/1 finds the data with id 1.
    delete /item/1 deletes the data with id 1

    reply
    0
  • Cancelreply