0

我在这段代码中有这个错误,我使用相同的PHP 结构 - 扩展方法就像扩展一个类,有什么问题?

    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);}
            }
    }
4

1 回答 1

0

我认为问题出在您nomaliza的抽象类方法中lidacomentradas

方法的调用不应该是$this->normalizaMyWay();函数normalizaMyWay();

于 2013-08-31T13:07:44.963 回答