1. Go to this page and download the library: Download cdyun/php-router library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
Route::error(function() {
echo '404 :: Not Found';
});
use Cdyun\PhpRouter\Route;
Route::get('/', 'Controllers\demo@index');
Route::get('page', 'Controllers\demo@page');
Route::get('view/(:num)', 'Controllers\demo@view');
Route::dispatch();
namespace Controllers;
class Demo {
public function index()
{
echo 'home';
}
public function page()
{
echo 'page';
}
public function view($id)
{
echo $id;
}
}
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.