根据if / else语句的不同视图

时间:2012-02-28 12:38:48

标签: php codeigniter

我在codeigniter中有一个if else语句,并尝试指向不同的视图,但它给我带来了错误。但是当我回显它打印到屏幕

这有效!

 public function kayitEmailOnay() {

        $registrationCode = $this->uri->segment(3);

        if ($registrationCode == '') {
            echo "URLde onay kodu yok";
        }


        $registrationConfirmed = $this->kayitmodel->uyeOnay($registrationCode);

        if ($registrationConfirmed)
            echo "true";
        else
            echo "false";
    }

这不起作用

  public function kayitSon() {
        $this->load->view("kayit/kayitTamamla");
    }
    public function kayitHata() {
        $this->load->view("kayit/kayitHata");
    }


    public function kayitEmailOnay() {

        $registrationCode = $this->uri->segment(3);

        if ($registrationCode == '') {
            echo "URLde onay kodu yok";
        }


        $registrationConfirmed = $this->kayitmodel->uyeOnay($registrationCode);

        if ($registrationConfirmed)
            kayitSon();
        else
            kayitHata();
    }

错误是: enter image description here

2 个答案:

答案 0 :(得分:3)

你应该像这样调用你的函数:

$this->kayitSon();
$this->kayitHata();

答案 1 :(得分:1)

使用对象或对象引用调用类方法。如果您在该类中调用类方法,请使用$this关键字

尝试使用$this

进行通话
$this->kayitSon();