douai2499 2012-10-28 13:18 采纳率: 100%
浏览 71
已采纳

Codeigniter回调函数不起作用

I am facing this problem from yesterday and can not fix it. My callback function is not working. It's always returning TRUE, but i don't know why? Can anyone help me?

Here is the the model:

class Login_model extends CI_Model {
public function check_login($str)
    {
        $this->form_validation->set_message('check_login', 'Error');
        return FALSE;

    }
function validate_login()
{
    $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email|xss_clean');
    $this->form_validation->set_rules('password', 'Password', 'callback_check_login');

    if($this->form_validation->run() == FALSE)
    {
        return FALSE;
    }

    return TRUE;
}}

The callback function should never return TRUE. But it's returning! I am going to die with this problem! :@

  • 写回答

1条回答 默认 最新

  • duan2428 2012-10-29 05:04
    关注

    It will return TRUE because

    1. You are not passing email and password to 'validate_login()'.
    2. So $this->form_validation->run() will not work.

    move validate_login() to any controller

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 VFP如何使用阿里TTS实现文字转语音?
  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题