openlss/lib-router 问题修复 & 功能扩展

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

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

openlss/lib-router

Composer 安装命令:

composer require openlss/lib-router

包简介

Router for handling web calls, allows dynamic registration at runtime

README 文档

README

Router for handling web calls, allows dynamic registration at runtime

Usage

use \LSS\Router;

Router::init();
Router::_get()->setRoot(ROOT);
Router::_get()->setDefault('/ctl/home.php');
Router::_get()->register('client','list'=>'/ctl/client_list.php');
$dest = Router::_get()->route(get('act'),get('do'),get('fire'));
require($dest);

Reference

(void) Router::init()

Calls the construct and starts the singleton

(object) Router::_get()

Returns the current instance

(string) Router::setDefault($dest)

Sets the default file to route too. Relative to root.

(string) Router::setRoot($root)

Set the root folder that all route calls are relative to.

(object) Router::register($act,$do=array())

  • $act The first routing argument
  • $do An array of secondary routing arguments
  • Do may also contain arrays of "fire" routing calls The router is tertiary

A more in depth example

Router::_get()->register('client',array(
	 'list'		=>	'/ctl/client_list.php'
	,'edit'		=>	'/ctl/client_edit.php'
	,'create'	=>	'/ctl/client_create.php'
	,'manage'	=>	array( //this is a tiertiary segment
		'contacts'		=>	'/ctl/client_manage_contacts.php'i
		 //set the default when the third segment is missing
		Router::DEF		=>	'/ctl/client_manage.php'	
	)
	//set the default when the second segment is missing
	,Router::DEF	=>	'/ctl/client_list.php'
));

(string) Router::route($act=null,$do=null,$fire=nul)

  • $act The first routing segment usually a get variable
  • $do The second routing segement usually a get variable
  • $fire The thrist routing segment Returns the controller to route to which should then be sent to require()

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2013-03-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固