bramus / router

A lightweight and simple object oriented PHP Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to run php file with command .for example: php index.php Home index

sajjadef98 opened this issue · comments

commented

how to run php file with command in bramus/router .for example in codeigniter : php index.php Home index
Home ---> Controller
index ----> Method

in Controller file

class Home {

    public function index() {
      echo "hi" ;
    }
}

and in router file

$router->get('/','Home@index');

command in public dir php index.php Home index

php index.php Home index
ErrorException {#21
  #message: "Warning: Undefined array key "REQUEST_METHOD""
  #code: 0
  #file: "C:\laragon\www\doc\vendor\bramus\router\src\Bramus\Router\Router.php"
  #line: 225
  #severity: E_WARNING
  trace: {
    C:\laragon\www\doc\vendor\bramus\router\src\Bramus\Router\Router.php:225 { …}
    C:\laragon\www\doc\vendor\bramus\router\src\Bramus\Router\Router.php:277 { …}
    C:\laragon\www\doc\Flare\app\Router.php:22 {
      require_once^
      ›
      › $router->run();
      ›
    }
    C:\laragon\www\doc\Flare\app\config.php:59 { …}
    C:\laragon\www\doc\public\index.php:5 { …}
  }
}