Thinkphp5.1 framework Routing:: get, post request simple usage example


This article describes the simple use of thinkphp5.1 framework route:: get, post request. To share with you for your reference, as follows:

1. Create a type method in the controller index under the index module

public function type(){
  Echo 'I am the test type';
  return view();

2. Under the index module, create a new view, create an index folder, and create a type.html page

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<form action="type" method="post">
<input type="text" name="name">
< input type = "submit" value = "submit" >

3. Set route


// or

Design sketch:

Input 111


For more information about ThinkPHP, readers who are interested in it can see the following topics: introduction to ThinkPHP, summary of operation skills of ThinkPHP template, summary of common methods of ThinkPHP, introduction to CodeIgniter, advanced tutorial of CI (CodeIgniter) framework, introduction to Zend framework and technical summary of PHP template.

I hope that this article will be helpful for you to design your PHP program based on the think PHP framework.

Recommended Today

[reading notes] calculation advertising (Part 3)

By logm This article was originally published at and is not allowed to be reproduced~ If the mathematical formula in the article cannot be displayed correctly, please refer to: Tips for displaying the mathematical formula correctly This article isComputing advertising (Second Edition)Reading notes. This part introduces the key technology of online advertising, which is […]