幽默好难学 2017-11-27 14:25 采纳率: 0%
浏览 315

求各位帮忙看看哪里出问题了?

控制器代码如下:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Form extends CI_Controller{

public function index(){
    $this->load->helper(array('form','url'));

    $this->load->library('form_validation');//验证初始化函数

    $this->form_validation->set_rules('username', 'Username', arrary($this->users_model, 'valid_username'));
    $this->form_validation->set_rules('password', 'Password', 'required');
    $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required|matches[password]');
    $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');
    //级联规则

    if ($this->form_validation->run()==FALSE)
    {
        $this->load->view('test/myform');
    }
    else{
        $this->load->view('test/formsuccess');
    }
}

public function username_check($str)
{
    if($str=='test'){
        $this->form_validation->set_message('username_check', 'The {field} field can not be the word "test"');
        return FALSE;
    }
    else{
        return TRUE;
    }
}

}
视图代码如下:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Form extends CI_Controller{

public function index(){
    $this->load->helper(array('form','url'));

    $this->load->library('form_validation');//验证初始化函数

    $this->form_validation->set_rules('username', 'Username', arrary($this->users_model, 'valid_username'));
    $this->form_validation->set_rules('password', 'Password', 'required');
    $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required|matches[password]');
    $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');
    //级联规则

    if ($this->form_validation->run()==FALSE)
    {
        $this->load->view('test/myform');
    }
    else{
        $this->load->view('test/formsuccess');
    }
}

public function username_check($str)
{
    if($str=='test'){
        $this->form_validation->set_message('username_check', 'The {field} field can not be the word "test"');
        return FALSE;
    }
    else{
        return TRUE;
    }
}

}
另一个页面:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Form extends CI_Controller{

public function index(){
    $this->load->helper(array('form','url'));

    $this->load->library('form_validation');//验证初始化函数

    $this->form_validation->set_rules('username', 'Username', arrary($this->users_model, 'valid_username'));
    $this->form_validation->set_rules('password', 'Password', 'required');
    $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required|matches[password]');
    $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');
    //级联规则

    if ($this->form_validation->run()==FALSE)
    {
        $this->load->view('test/myform');
    }
    else{
        $this->load->view('test/formsuccess');
    }
}

public function username_check($str)
{
    if($str=='test'){
        $this->form_validation->set_message('username_check', 'The {field} field can not be the word "test"');
        return FALSE;
    }
    else{
        return TRUE;
    }
}

}
但是不能显示效果,显示页面不存在。

  • 写回答

1条回答 默认 最新

  • 你知我知皆知 2024-08-07 04:25
    关注

    以下回答参考 皆我百晓生券券喵儿 等免费微信小程序相关内容作答,并由本人整理回复。

    从你的描述来看,你似乎遇到了一些与PHP和MySQL数据库交互有关的问题。为了更好地帮助您解决问题,我建议您提供以下信息:

    1. 当前的错误消息或提示。
    2. 使用的数据库驱动(例如PDO、mysqli等)。
    3. MySQL服务器是否正常运行。
    4. 是否有其他错误或警告消息。
    5. 如果是前端应用,请提供HTML/CSS/JavaScript代码片段以及浏览器日志截图。

    根据这些信息,我可以为您提供更具体的解决方案。

    评论

报告相同问题?

悬赏问题

  • ¥15 这种情况的伯德图和奈奎斯特曲线怎么分析?
  • ¥50 paddleocr带斜线的0很容易识别成9
  • ¥15 电子档案元素采集(tiff及PDF扫描图片)
  • ¥15 flink-sql-connector-rabbitmq使用
  • ¥15 zynq7015,PCIE读写延时偏大
  • ¥15 使用spss做psm(倾向性评分匹配)遇到问题
  • ¥20 vue+UEditor附件上传问题
  • ¥15 想做个WPS的自动化代码,不知道能做的起不。
  • ¥15 uniApp,生成安卓安卓包后,黑暗主题中间内容不生效,底部导航正常
  • ¥15 斯坦福自动漂移非线性模型反解