02-tp5 read request parameters of notes in three ways php

01- [] recommended way

When the browser makes a request to the Web server, it sends a data block to the server, the request information is. In Thinkphp5.1, object data acquisition request, by the think \ Request responsible class, does not need to be instantiated call in many cases, can be generally used dependency injection,

$request->param('name');

 

02- In other applications (e.g., output templates, etc.) may be used think \ facade \ Request static class operation.

Request::param('name');

03- helper function [2] recommended

// Get get all parameters of 
INPUT ( ' get. ' ); 

// get all the parameters of the post 
INPUT ( ' post. ' ); 

// get all the parameters of any type 
INPUT ( ' param. ' ); 

// Get id 
INPUT ( ' get.id ' ); 

// determines whether there is a key value 
INPUT ( ' name? ' );

 

Guess you like

Origin www.cnblogs.com/somethingWithiOS/p/11963358.html