简体   繁体   中英

Fatal error: Call to undefined function normalizamyway() php abstract class

I have this error in this code, I use the same structure of PHP - extend method like extending a class , what is the problem?

    abstract class lidacomentradas 
{public $texto;

    function __construct($entrada) {
             $this->texto = $entrada;
        }

        abstract public function normalizaMyWay();

        public function normaliza() { 
            $this->texto = str_replace("'",'"',$this->texto);
            $this->texto = preg_replace("/[():]/", "", $this->texto);
            $this->texto = NormalizaEspacos($this->texto );
            normalizaMyWay();

        }



    }

    class titulo extends lidacomentradas {

            public function normalizaMyWay(){;} 

            public function criaUrl(){
                return str_replace(" ","_",(strtolower(LimpaTexto($this->texto))));
                }

    }

    class corpo extends lidacomentradas {

            public function normalizaMyWay() {
                $lixo=strpos("Esta notícia foi acessada",$this->texto);

                if ($lixo<>0) {$this->texto= substr($this->texto,0,$lixo);}
            }
    }

I think the problem is in your nomaliza method in abstract class lidacomentradas .

The calling of method should be $this->normalizaMyWay(); not as function normalizaMyWay();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM