注册页面

在application/index/controller下新建Regist.php文件

写入注册的前端页面,代码如下:

<?php
namespace app\index\controller;
use think\View;
use think\Controller;
class Regist extends Controller{
  public function index(){
   $view = new View();
   return $view->fetch('index');
  }
}

View视图指向index目录,在application/index目录下新建View/regist/index.html文件,写入前端代码如下:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>注册</title>
  </head>
  <style>
   dl{
      text-align:center;
      border:2px solid #008800;
      margin-top:100px;
      margin-bottom:100px;
      margin-right:700px;
      margin-left:700px;
   }
  </style>
  <body>
<div id="regist_form">
<dl>
  <form action="/public/index.php/index/regist/regist" method="post">
<dt>
  <h1>注册页面</h1>
    <p>姓名:<input type="text" name="UserName"></p>
</dt>
<dt>
  <p>性别:男<input type="radio" name="UserSex" value="0">女<input type="radio" name="UserSex" value="1"></p>
</dt>
<dt>
  <p>手机:<input type="text" name="UserTel"></p>
</dt>
<dt>
  <p>邮件:<input type="text" name="UserEmail"></p>
</dt>
<dt>
  <p>地址:<input type="text" name="UserAddress"></p>
</dt>
<dt>
  <p>生日:<input type="text" name="UserBirth"></p>
</dt>
<dt>
  <p>密码:<input type="password" name="UserPasswd"></p>
</dt>
<dt>
  <p>个性签名:<input type="text" name="UserSignature"></p>
</dt>
<dt>
  <p>喜好:<input type="text" name="UserHobby"></p>
</dt>
<dt>
  <p><input type="submit" value="注册"></p>
</dt>
  </form>
</dl>
</div>
  </body>
</html>

在浏览器输入运行http://localhost/public/index.php/index/regist/index

效果如下所示:

微信图片_20180307131300.png

继续学习
||
<?php echo "注册页面展示";
提交重置代码
章节
笔记
提问
课件
反馈
捐赠

TP5.0实现简易管理员登录注册功能

  • 推荐课程
  • 评论
  • 问答
  • 笔记
  • 课件下载

逝水流年

固定宽度页面布局显示一半

7年前    添加回复 1

吢死丶情灭

坑人啊,页面都出来了,两个都登录,显示模块不存在:public

4年前    添加回复 0

超级土豆

User都没引入Regist里怎么用?

5年前    添加回复 0

暖阳

404 Not Found PhpStorm 2018.2.1 然后报错了

6年前    添加回复 0

勿言无言

写的什么东西啊?完全没一点条理,bug满天飞,网页源代码都有错误

7年前    添加回复 0

日积月累

index模板访问直接return $this->fetch()。不用实例化后再调用 模板左右外边距太大了。文本压变形了

7年前    添加回复 0

日积月累

<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.ph

7年前    添加回复 0

罗松

左右改成500像素距离就好了

7年前    添加回复 0

ABC的C

请问谁做完这个了,能提供下源代码不,我写完了有点问题,加QQ1228333267

7年前    添加回复 0

逝水流年

为什么页面只出现一半呢

7年前    添加回复 0

我也按照这个步骤试了,最后出不来结果

[最新 细嗅蔷薇 的回答] 路径出错吧,访问不到

时间:6年前

课件暂不提供下载,工作人员正在整理中,后期请多关注该课程~