Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Feb 1, 2018
1 parent 88f17a1 commit 39cebc4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
19 changes: 4 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,7 @@ Macaw - first route (1000 routes) | 999 | 2.710132 | +2.703545 | 41047% slower

## 使用

- `Inhere\Route\SRouter` 是静态类版本
- `Inhere\Route\ORouter` 是对象版本
- `Inhere\Route\CachedRouter` 是支持缓存的版本

两个类的方法名和参数都是一样的
> 各个版本的方法名和参数都是一样的
首先, 导入类

Expand Down Expand Up @@ -198,7 +194,7 @@ $router->rest('/users', App\Controllers\UserController::class);
$router->any('*', 'fallback_handler');
```

> 如果配置了 `'ignoreLastSep' => true`, '/index' 等同于 '/index/'
> 如果配置了 `'ignoreLastSlash' => true`, '/index' 等同于 '/index/'
#### 注意

Expand Down Expand Up @@ -309,7 +305,7 @@ Now, 访问 `/im/john/18` 或者 `/im/john` 查看效果
```php
// set config
$router->setConfig([
'ignoreLastSep' => true,
'ignoreLastSlash' => true,
'autoRoute' => 1,
'controllerNamespace' => 'app\\controllers',
'controllerSuffix' => 'Controller',
Expand Down Expand Up @@ -514,14 +510,7 @@ MIT

功能丰富的命令行应用,命令行工具库

### `inhere/redis` [github](https://github.com/inhere/php-redis) [git@osc](https://git.oschina.net/inhere/php-redis)

简单的redis操作客户端包装库

### `inhere/php-validate` [github](https://github.com/inhere/php-validate) [git@osc](https://git.oschina.net/inhere/php-validate)

一个简洁小巧且功能完善的php验证库。仅有几个文件,无依赖。

### `inhere/http` [github](https://github.com/inhere/php-http) [git@osc](https://git.oschina.net/inhere/php-http)

http 工具库(`request` 请求 `response` 响应 `curl` curl请求库,有简洁、完整和并发请求三个版本的类)

6 changes: 3 additions & 3 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ $router->group('/user', function () {
### use controller action

```php
// if you config 'ignoreLastSep' => true, '/index' is equals to '/index/'
// if you config 'ignoreLastSlash' => true, '/index' is equals to '/index/'
$router->get('/index', 'app\controllers\Home@index');
```

Expand Down Expand Up @@ -209,7 +209,7 @@ Will directly execute the callback
```php
// set config
$router->setConfig([
'ignoreLastSep' => true,
'ignoreLastSlash' => true,

// 'matchAll' => '/', // a route path
// 'matchAll' => function () {
Expand All @@ -230,7 +230,7 @@ $router->setConfig([
// there are default config.
[
// ignore last '/' char. If is True, will clear last '/', so '/home' equals to '/home/'
'ignoreLastSep' => false,
'ignoreLastSlash' => false,

// matchAll all request.
// 1. If is a valid URI path, will matchAll all request uri to the path.
Expand Down
6 changes: 3 additions & 3 deletions docs/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $router->group('/user', function ($router) {
});
```

> 如果配置了 `'ignoreLastSep' => true`, '/index' 等同于 '/index/'
> 如果配置了 `'ignoreLastSlash' => true`, '/index' 等同于 '/index/'
### 实现原理(如何收集)

Expand Down Expand Up @@ -334,7 +334,7 @@ todo ...
```php
// set config
$router->setConfig([
'ignoreLastSep' => true,
'ignoreLastSlash' => true,
'autoRoute' => 1,
'controllerNamespace' => 'app\\controllers',
'controllerSuffix' => 'Controller',
Expand All @@ -347,7 +347,7 @@ $router->setConfig([
// 所有的默认的配置

// 是否忽略最后的 '/' 分隔符. 如果是 true,将清除最后一个 '/', 此时请求 '/home' 和 '/home/' 效果相同
'ignoreLastSep' = false,
'ignoreLastSlash' = false,

// 匹配所有请求
// 1. 如果是一个有效的URI路径,将匹配所有请求到此URI路径。
Expand Down

0 comments on commit 39cebc4

Please sign in to comment.