pijush_gupta / php-router

简单的 Php 路由器

dev-main 2022-12-29 17:28 UTC

This package is auto-updated.

Last update: 2024-09-29 06:09:15 UTC


README

Php 路由器

克隆此仓库
git clone https://github.com/Pijushgupta/php-router.git
将其添加到项目中
include_once 'Location of file';
或者使用 Composer/auto-loader
composer require pijush_gupta/php-router:dev-main
在项目中使用它
use phpRouter\Router;
new Router('/', function () {
	echo 'Home';
});
带参数的获取方法
https://example.com?a=Pijush&b=Gupta
new Router('/',function($a,$b){ //exact number of variables and name as query vars from url.
	echo $a . $b;
})
POST 方法
https://example.com/
new Router('/',function($post){ //variable name for the param can be anything
	var_dump($post);
});