Macaw::get("exec",array(
array("f"),
function ($f){
return "hello closure".$f;
}
));如: 伪静态 http://127.0.0.1/test/a/1/b/2/c/3 正常请求 http://127.0.0.1/test?a=1&b=2&c=3
<?php
use NoahBuscher\Macaw\Macaw;
Macaw::get("exec",array(
array("f"),
function ($f){
return "hello closure".$f;
}
));
Macaw::get('heads', 'app\\Controllers\\demo@head');
Macaw::get('/', 'app\\Controllers\\demo@index');
Macaw::get('page', 'app\\Controllers\\demo@picfortext');
Macaw::get('/adm5', 'app\\Controllers\\demo@Admin5read');
Macaw::get('/sleep', 'app\\Controllers\\sleep@index');
Macaw::get('/Pen', 'app\\Mapp\\phpsec\\Filters@index');
Macaw::post('/Pen/addlash', 'app\\Mapp\\phpsec\\Filters@addlash');
Macaw::get('/Pen/checkMail', 'app\\Mapp\\phpsec\\Filters@checkMail');
echo Macaw::dispatchbyq();//emptyparm method
if (empty($ReMethodParams)){
return Container::run($controler,$method);
}原有dispatch方法魔改
private static $res = null;
......
self::$res = call_user_func_array(self::$callbacks[$pos], $matched);
......
public static function Result(){
self::dispatch();
return self::$res;
}需要使用wazsmwazsm大佬的IOC库,和noahbuscher大佬的Macaw路由库,特此感谢
项目地址
https://github.com/wazsmwazsm/IOCContainer安装方法
composer require wazsmwazsm/ioc-container项目地址
https://github.com/noahbuscher/macaw安装方法
require: {
"noahbuscher/macaw": "dev-master"
}cpmposer install