新手写登录注册function为什么写相同代码不同的函数结果不同

浏览:587 发布日期:2014/10/14 分类:求助交流
<?php
namespace Home\Controller;
use Think\Controller;
class UserController extends Controller {
    public function index(){
        $this->display();
   }
   public function login(){
       //$_GET $_POST
       $data = I('post.');
       $msg = '用户名输入正确';
       if($data['username'] == 'admin' && $data['userpwd'] == 'admin'){ 
           $this->show($msg);
       }else{ 
           $this->show('输入的不对');
       }
   }
      public function register(){
       //$_GET $_POST
       $data = I('post.');
       $msg = '用户名输入正确';
       if($data['username'] == 'admin' && $data['userpwd'] == 'admin'){ 
           $this->show($msg);
       }else{ 
           $this->show('输入的不对');
       }
   }
}
     <meta http-equiv="Content-Type" Content="text/html;charset=utf-8" />
     <body>
     <form action="{:U('Home/User/register')}" method="post">
         用户名:<input type="text" name="username">
         密码: <input type="password" name="userpwd">
         <input type="submit">
     </form>
     </body>
大家看下register函数有错吗,为什么不能正常运行,运行后直接跳过html页面直接显示结果
最佳答案
评论( 相关
后面还有条评论,点击查看>>