bephp / router Goto Github PK
View Code? Open in Web Editor NEWA barebones router for PHP. Automatic get variable based on handler function parameter list. Suport to compile router callback handlers into plain array source code.
A barebones router for PHP. Automatic get variable based on handler function parameter list. Suport to compile router callback handlers into plain array source code.
->get('/Message/photo/:id:d-:index:d-:width:d-:height:d.jpg',function($id, $index,$width,$height){
$arr = get_defined_vars();
print_r($arr);
})
浏览器访问这个URL能正常,但结果是下面这样,是我哪里处理的不对?
Array ( [id] => [index] => [width] => [height] => )
using explode to split the path info, instead of preg_match.
protected function needComplie()
should be
protected function needCompile(){
感觉源码文件都放到root下面有点儿不太清晰,不过也就一个文件...
ToT
add hook like auth and so on.
may be can format parameters before call handler function.
Not even in the demo
这个如果支持,请教如何做,非常感谢。
compile the matched callback handlers into plain array. do not create array "$_tree" every time.
when define one group, can define hooks for this group.
$router->group('/admin', array('auth'));
this example define group url prefixed by '/admin', and all these urls has 'auth' hook.
need pass router object to after hook handler.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.