基于 HTTP Query String 做路由解析, 默认支持协议
asf.dispatcher.route 项无需配置, Asf_Route_Pathinfo 默认路由协议
<?php
$configs = array(
'asf' => array(
'root_path' => realpath(dirname(__FILE__)),
)
);
$handle = new Asf_Application($configs);
$handle->run();
/* path: /data/www/api/services/User.php */ curl domain.cn/index/user/list curl domain.cn/index/user/list/username/zhangsan/nickname/haha /* path: /data/www/api/services/Index.php */ curl domain.cn/index/index
/* path: /data/www/admin/services/User.php */ curl domain.cn/Admin/UsEr/LIST curl domain.cn/admiN/UsER/LisT/username/zhangsan/nickname/haha /* path: /data/www/admin/services/Index.php */ curl domain.cn/aDMin/Index/IndEx
基于 HTTP Query String 做路由解析
<?php
$configs = array(
'asf' => array(
'root_path' => realpath(dirname(__FILE__)),
'dispatcher' => array(
'route' => array(
'type' => 'dot',
)
)
)
);
$handle = new Asf_Application($configs);
$handle->run();
<?php
$configs = array(
'asf' => array(
'root_path' => realpath(dirname(__FILE__)),
'dispatcher' => array(
'route' => array(
'type' => 'dot',
'dot_name' => 'method',
)
)
)
);
$handle = new Asf_Application($configs);
$handle->run();
/* services/index.php */ curl "domain.cn/index.php?method=index.index.index" curl "domain.cn/index.php?method=index.index" curl "domain.cn/index.php?method=index.index&username=zhangsan&nickname=haha" /* services/index/user.php */ curl "domain.cn/index.php?method=index.user.str"
基于 HTTP Query String 做路由解析
<?php
$configs = array(
'asf' => array(
'root_path' => realpath(dirname(__FILE__)),
'dispatcher' => array(
'route' => array(
'type' => 'query',
)
)
)
);
$handle = new Asf_Application($configs);
$handle->run();
<?php
$configs = array(
'asf' => array(
'root_path' => realpath(dirname(__FILE__)),
'dispatcher' => array(
'route' => array(
'type' => 'query',
'module_name' => 'm',
'service_name' => 's',
'action_name' => 'a',
)
)
)
);
$handle = new Asf_Application($configs);
$handle->run();
/* services/index/user.php */ curl "domain.cn/index.php?m=index&s=user&a=str" curl "domain.cn/index.php?m=index&s=user&a=list&username=zhangsan&userpass=123456" curl "domain.cn/index.php?m=index&s=user&a=add&username=zhangsan&userpass[]=123456&userpass[]=56789" -g