openlss / lib-url
支持运行时动态注册的URL构建库。
0.0.11
2013-05-08 02:02 UTC
Requires
- php: >=5.3.2
- openlss/core-boot: ~0.0.1
- openlss/lib-config: ~0.0.1
This package is not auto-updated.
Last update: 2024-09-14 14:24:30 UTC
README
支持运行时动态注册的URL构建库。
使用方法
use \LSS\Url; //registration Url::_register('home',Url::_prep().'/index.php'); Url::_register('myapp',Url::home().'?act=myapp'); Url::_register('myapp_create',Url::myapp().'&do=create'); Url::_register('myapp_edit',Url::myapp().'&do=edit&id=$1'); //usage $url = Url::home(); $url = Url::myapp(); $url = Url::myapp_create(); $url = Url::myapp_edit($id);
参考
(string) Url::_prep()
返回配置的根URL
(bool) Url::_isCallable($func)
检查是否已注册URL函数
(array) Url::_all()
返回所有无需参数的URL(全局URL)
(void) Url::_register($name,$url)
- $name 访问URL的函数名
- $url URL本身,鼓励使用其他函数
- $1 $2 $3 与正则表达式反向引用类似的编号参数,它们引用传递给URL函数的参数编号