سلام استاد خسته نباشید من همون کدایی که گفتید رو نوشتم توی tinyMVC ولی وقتی اومدم از ReflectionMethod استفاده کنم به اروری که تو عکس واستون فرستادم خوردم ممنون میشم راهنمایی کنید
این هم کد اون کلاسی که نوشتم
<?php
namespace System\router;
use ReflectionMethod;
class Routing{
private $currentRoute;
public function __construct(){
global $currentRoute;
$this->currentRoute = explode("/", $currentRoute);
}
public function run(){
$path = realpath(__DIR__ . "/../../application/controllers/" . $this->currentRoute[0] . ".php");
if(!file_exists($path)){
echo "404 - file not found";
}else{
sizeof($this->currentRoute) == 1 ? $method = "index" : $method = $this->currentRoute[1];
$class = "Application\Controllers\\" . $this->currentRoute[0];
$object = new $class();
if(method_exists($object, $method)){
$reflection = new ReflectionMethod($object, $method);
}
}
}
}
سلام وقت بخیر
ورژن php رو برای این دوره باید روی ۸.۱ بذارید