jeudi 20 avril 2017

PHP call function/method between class file

I need to call a function from a separate class file, let says:

class Functions {

    public function seoUrl($string)
       $string = strtolower($string);
       $string = preg_replace("~[^\p{L}\p{N}\n]+~u", "-", $string);
       $string = preg_replace("/[\s-]+/", " ", $string);
       $string = preg_replace("/[\s_]/", "-", $string);
       return $string;


I want Functions::seoUrl() to be call in another class file:

class Product {

    public function goto_url($url)
       return Functions::seoUrl($url);


I get error:

Fatal error: Class 'Functions' not found in C:\xampp\htdocs\...

I would be grateful if anyone can point me a solution. TQ


0 commentaires:

Enregistrer un commentaire