Tanımsız sabit ADMIN Kullanımı - 'ADMIN' üstlendi

0 Cevap php

Benim kod çalışırken, ben inci kodu ile yanlış bir şey bulamıyorum Use of undefined constant NORMAL - assumed 'NORMAL' hatayı alıyorum

var $type;

    const NORMAL=1;
    const ADMIN=2;

    public function getTypeOptions(){
        return array(
            self::NORMAL=>'Normal',
            self::ADMIN=>'Administrator',
        );
    }

    public function getTypeText(){

        $options[NORMAL];
        $options[ADMIN];

        $options=$this->getTypeOptions();
        return $options;
    }

    public function getTypeByText($type){
        $options = $this->getTypeText();
        if($type == 1){
            return $options[1];
        }else if($type == 2){
            return $options[2];
        }
    }

Ben bu kapılıyorum ben getTypeByText yöntemini type = 2 değeri çağrı

0 Cevap