Home PHP Framework ThinkPHP 5 ways to get the parameters in the api request address in thinkphp6

5 ways to get the parameters in the api request address in thinkphp6

Jun 19, 2020 pm 01:30 PM
api thinkphp6

The following tutorial column of thinkphp framework will introduce to you 5 methods of obtaining parameters in the api request address in thinkphp6. I hope it will be helpful to friends in need!

5 ways to get the parameters in the api request address in thinkphp6

#First method

tp6 The difference from tp5 is that tp6 inherits the controller Baseconroller, so we can directly use the request method in Baseconroller.

1

2

3

public function show(){

    dump($this->request->param("abc",2,'intval'));

    }

Copy after login

Parameter analysis


5 ways to get the parameters in the api request address in thinkphp6name Parameter name

default Default value

filter Convert the obtained parameters into integers

The second method

No need to inherit BaseContoller and pass in the Request object in the method


5 ways to get the parameters in the api request address in thinkphp6##The third and fourth method

5 ways to get the parameters in the api request address in thinkphp6The fifth way to use request in human face mode

5 ways to get the parameters in the api request address in thinkphp6Personally, I think the first method is new in tp6, so we might as well develop it in practice Use it during the process, because it may be more convenient to use it. For example, it is very simple to judge whether it is a get request or other requests


5 ways to get the parameters in the api request address in thinkphp6

##

The above is the detailed content of 5 ways to get the parameters in the api request address in thinkphp6. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Manticore Search Development Guide: Quickly Create a Search API PHP and Manticore Search Development Guide: Quickly Create a Search API Aug 07, 2023 pm 06:05 PM

PHP and Manticore Search Development Guide: Quickly Create a Search API

How to crawl and process data by calling API interface in PHP project? How to crawl and process data by calling API interface in PHP project? Sep 05, 2023 am 08:41 AM

How to crawl and process data by calling API interface in PHP project?

React API Call Guide: How to interact and transfer data with the backend API React API Call Guide: How to interact and transfer data with the backend API Sep 26, 2023 am 10:19 AM

React API Call Guide: How to interact and transfer data with the backend API

Oracle API Usage Guide: Exploring Data Interface Technology Oracle API Usage Guide: Exploring Data Interface Technology Mar 07, 2024 am 11:12 AM

Oracle API Usage Guide: Exploring Data Interface Technology

Oracle API integration strategy analysis: achieving seamless communication between systems Oracle API integration strategy analysis: achieving seamless communication between systems Mar 07, 2024 pm 10:09 PM

Oracle API integration strategy analysis: achieving seamless communication between systems

Save API data to CSV format using Python Save API data to CSV format using Python Aug 31, 2023 pm 09:09 PM

Save API data to CSV format using Python

How to deal with Laravel API error problems How to deal with Laravel API error problems Mar 06, 2024 pm 05:18 PM

How to deal with Laravel API error problems

PHP API Interface: Getting Started Guide PHP API Interface: Getting Started Guide Aug 25, 2023 am 11:45 AM

PHP API Interface: Getting Started Guide

See all articles