GianC adlı üyeden alıntı: mesajı görüntüle
hocam sizin yapmak istediğiniz şey için class açıp classın içine fonksiyon yerleştirmek lazım normal fonksiyonu bağlayamazsınız
kullanım şekli
$g=new WebRoute();
__pre($g->route("etkinlikler")->getLink());
aldığım hata :Fatal error: Uncaught Error: Call to a member function getLink() on string in C:Sanalsunucu/www/davulgablog/web/dkv4/makale.php on line 52
<?php
final class WebRoute{
   public$menu =null;
   public $slug='';
   public $link='';
   public $name='';
   public $route='';
   public $routes=array();
    function __construct(){
        $rotalar=ayar_cek("web_rota");
        $this->routes=json_decode($rotalar);      
    }
    function route($name='',$tip="link")
    {
        if(!empty($name)){
          if(isset($this->routes->$name)){
            $route=$this->routes->$name;
            if($tip=="link" && isset($route->link)){
                $this->link=$route->link;
                return $route->link;
            }elseif($tip=="rota" && isset($route->rota)){
                $this->route=$route->rota;
                return $route->rota;
            }
            if($tip=="slug" && isset($route->slug)){
              $slug=self::setSlug($route->slug);
              if(!empty($slug)){
               return $slug;
              }else{
                return '';
              }
            }
          }
        }
        return '';
      }
    function getLink(){
        return $this->link;
    }
    function getRoute(){
        return $this->route;
    }
    function getName(){
        return $this->name;
    }
    function convertSlug(){
        if(!empty($this->slug)){
            
        }
    }
    function setSlug($slug){
        $exp=explode("|",$slug);
        if(!empty($exp)){
         $this->slug=$exp;
         return $exp;
        }{
         $this->slug=$slug;
          return $slug;
        }
    }
}

?>