用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3847|回复: 2
收起左侧

初次用CI,为什么程序不执行?

[复制链接]
发表于 2008-4-26 21:41:41 | 显示全部楼层 |阅读模式
controller/center/register.php
----------------------------------------------------------------
class Register extends Controller{
        function index(){
                $this->load->helper(array('form','url'));
                $this->load->library('validation');
                $rules['username'] = "required";
                $rules['password'] = "required";
                $rules['repassword'] = "required";
                $rules['email'] = "required";
                $rules['idcard'] = "required";
                $rules['autocode'] = "required";
                $this->validation->set_rules($rules);

                if ($this->validation->run() == false){
                        $this->load->view('center/v_register');
                }else{
                        $this->load->view('center/v_register_secussful');
                }
        }
}
-------------------------------------------------------

view/center/v_register.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><? //=$title."--".$link;?></title>
</head>

<body>
<?=$this->validation->error_string;?>
<?=form_open('center/register'); ?>
  <label for="username">帐号:</label>

  <input type="text" name="username" id="username" class="" maxlength="20"   /><br />
  <label for="password">密码:</label>

  <input type="password" name="password" id="password" class="" maxlength="32"  /><br />
  <label for="password">确认密码:</label>

  <input type="password" name="repassword" id="repassword" class="" maxlength="32"  /><br />
  <label for="email">Email:</label>

  <input type="text" name="email" id="email" class="" maxlength="32"  /><br />
  <label for="idcard">身份证号码:</label>

  <input type="text" name="idcard" id="idcard" class="" maxlength="18"  /><br />
  <label for="autocode">验证码:</label>

  <input name="autocode" type="text" class="" id="autocode" size="5" maxlength="5"  />
  <br />
  <input name="ipaddress" type="hidden" class="" id="ipaddress" value="<?=$_SERVER['REMOTE_ADDR'];?>"  />
  <input name="register_time" type="hidden" class="" id="register_time" value="<?=date('Y-m-d H:i:s',time());?>"  />
  <input name="" type="button" value="提交" />
<?=form_close();?>
</body>
</html>

以上有什么问题?请指教。
发表于 2008-4-26 22:16:25 | 显示全部楼层
从你的控制器和视图看没问题,不过控制器少了一个构造函数。
你用什么URL访问的?什么服务器?CI是什么版本?
发表于 2008-4-28 11:43:21 | 显示全部楼层
why not start with "Hello World";

本版积分规则