Several ways of URL-passing parameters in thinkphp

Source: Internet
Author: User

In thinkphp, the principle is similar in URL participating ASP, the following is a brief explanation of single parameter and multiple parameter passing way

1. Flyer parameters

A single parameter is relatively simple, such as imagining an edit operation that passes an ID value, as in the following notation __URL__/EDIT/ID/1

Http://localhost/index.php/user/edit/id/1

ID and its value 1 are to be located/behind each

The background gets the ID by $id =$_get[' id ') to get its specific value.

2. Pass multiple parameters

It is a bit more troublesome to pass multiple parameters, and there are two ways

The first type: Pass ID, and status

Http://localhost/index.php/user/edit/id/1/status/2

The status parameter is immediately followed by writing

Get two parameters in the background

$id =$_get[' id ']; $status =$_get[' status ');

There is also a more general use of the following:

http://localhost/index.php/user?id=1&&status=2

However, this method can not be obtained by $_get[' ID '), which needs to be done in the following way

$id =$_request[' id ']; $status =$_request[' status '); //Can be obtained by $_get[' ID '), via $_request[' ID '). 

  

 

Several ways of URL-passing parameters in thinkphp

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.