search
HomePHP FrameworkThinkPHPthinkphp5 view file submission form form background reception and printing

The following is the thinkphp framework tutorial column to introduce to you thinkphp5 view file submission form form background reception and printing, I hope it will be helpful to friends in need!

thinkphp5 view file submission form form background reception and printing method

    • ##view layer html code
    • controller layer php method
    • thinkphp accepts post submission function
    • thinkphp comes with print function
view layer html code

<!--header-->{include file="public/_meta" /}<article class="page-container">
  <form class="form form-horizontal" id="form-admin-add" method="post" action="{:url(&#39;admin/add&#39;)}">
    <p class="row cl">
      <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>管理员名:</label>
      <p class="formControls col-xs-8 col-sm-9">
        <input type="text" class="input-text" value="" placeholder="" id="username" name="username">
      </p>
    </p>
    <p class="row cl">
      <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>密码:</label>
      <p class="formControls col-xs-8 col-sm-9">
        <input type="password" class="input-text" autocomplete="off" value="" placeholder="密码" id="password" name="password">
      </p>
    </p>
    <p class="row cl">
      <p class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
        <input class="btn btn-primary radius" type="submit" value="  提交  ">
      </p>
    </p>
  </form></article>{include file="public/_footer" /}</body></html>

Controller layer php Method

<?php namespace app\admin\controller;use think\Controller;class Admin extends Controller{
    public function add()
    {
        //判断是否为post提交
        if (request()->isPost()) {
            //得到post提交的数据
            $data=(input('post.'));
            dump(input('post.'));//打印后,继续执行
            //halt(input('post.'));//相当于 dump() + exit(),打印后,退出 
        } else {
            //加载视图文件
            return $this->fetch();
        }
    }}

thinkphp5 view file submission form form background reception and printing
thinkphp5 view file submission form form background reception and printing

thinkphp accepts post submission function

$data=(input('post.'));

thinkphp comes with its own printing function

dump(input('post.'));//After printing, continue execution

halt(input('post.'));//Equivalent to dump() exit(), after printing, exit

Related recommendations:

The latest 10 thinkphp video tutorials

The above is the detailed content of thinkphp5 view file submission form form background reception and printing. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version