luckystar/php-router 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

luckystar/php-router

最新稳定版本:v1.4

Composer 安装命令:

composer require luckystar/php-router

包简介

A simple and fast PHP router

README 文档

README

simple and fast php page router.

#How Install

 composer require luckystar/php-router

Plase add .htacces file:

Features

  • GET/POST Methods
  • Simple To Use
  • Easily import php or html files
  • You cant use parameters. :(

upcoming features

  • Add Parameters.
  • Add Middleware

Usage/Examples

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Set Theme folder

LuckyStar\PhpRouter\BHRouter::$themeFolder = "src/themes/";

Calling php when the index request comes

LuckyStar\PhpRouter\BHRouter::get("/", 'index.php');

Calling php when the about request comes

LuckyStar\PhpRouter\BHRouter::get("/about", 'about-page.php');

Calling function when the index request comes

 LuckyStar\PhpRouter\BHRouter::post("/", function(){
    echo "test";
});

pass variables

$pages = ['index','header','footer'];
LuckyStar\PhpRouter\BHRouter::get("/", 'index.php', $pages);

Get URL Parameters

LuckyStar\PhpRouter\BHRouter::get('/bloglar/tes/{name}/{surname}', 'bloglar.php');

OR

LuckyStar\PhpRouter\BHRouter::get('/bloglar/tes/{name}/{surname}', function(){
    echo $_GET['name'];
    echo $_GET['surname'];
});

404 pages usage: (should be added to the end of the page. )

LuckyStar\PhpRouter\BHRouter::noOne("/404", function(){
    echo "there is no such page";
});

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-04