1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
use think\exception\RouteNotFoundException;
use think\route\AliasRule;
use think\route\dispatch\Url as UrlDispatch;
use think\route\Domain;
use think\route\Resource;
use think\route\RuleGroup;
use think\route\RuleItem;
class Route
{
/**
* REST定义
* @var array
*/
protected $rest = [
'index' => ['get', '', 'index'],
'create' => ['get', '/create', 'create'],
'edit' => ['get', '/<id>/edit', 'edit'],
'read' => ['get', '/<id>', 'read'],
'save' => ['post', '', 'save'],
'update' => ['put', '/<id>', 'update'],
'delete' => ['delete', '/<id>', 'delete'],
];
/**
* 请求方法前缀定义
* @var array
*/
protected $methodPrefix = [
'get' => 'get',
'post' => 'post',
'put' => 'put',
'delete' => 'delete',
'patch' => 'patch',
];
/**
* 应用对象
* @var App
*/
protected $app;
/**
* 请求对象
* @var Request
*/
protected $request;
/**
* 当前HOST
* @var string
*/
protected $host;
/**
* 当前域名
* @var string
*/
protected $domain;
/**
* 当前分组对象
* @var RuleGroup
*/
protected $group;
/**
* 配置参数
* @var array
*/
protected $config = [];
/**
* 路由绑定
* @var array
*/
protected $bind = [];
/**
* 域名对象
* @var array
*/
protected $domains = [];
/**
* 跨域路由规则
* @var RuleGroup
*/
protected $cross;
/**
* 路由别名
* @var array
*/
protected $alias = [];
/**
* 路由是否延迟解析
* @var bool
*/
protected $lazy = true;
/**
* 路由是否测试模式
* @var bool
*/
protected $isTest;
/**
* (分组)路由规则是否合并解析
* @var bool
*/
protected $mergeRuleRegex = true;
/**
* 路由解析自动搜索多级控制器
* @var bool
*/
protected $autoSearchController = true;
public function __construct(App $app, array $config = [])
{
$this->app = $app;
$this->request = $app['request'];
$this->config = $config;
$this->host = $this->request->host(true) ?: $config['app_host'];
$this->setDefaultDomain();
}
public function config($name = null)
{
if (is_null($name)) {
return $this->config;
}
return isset($this->config[$name]) ? $this->config[$name] : null;
}
/**
* 配置
* @access public
* @param array $config
* @return void
*/
public function setConfig(array $config = [])
{
$this->config = array_merge($this->config, array_change_key_case($config));
}
public static function __make(App $app, Config $config)
{
$config = $config->pull('app');
$route = new static($app, $config);
$route->lazy($config['url_lazy_route'])
->autoSearchController($config['controller_auto_search'])
->mergeRuleRegex($config['route_rule_merge']);
return $route;
}
/**
* 设置路由的请求对象实例
* @access public
* @param Request $request 请求对象实例
* @return void
*/
public function setRequest($request)
{
$this->request = $request;
}
/**
* 设置路由域名及分组(包括资源路由)是否延迟解析
* @access public
* @param bool $lazy 路由是否延迟解析
* @return $this
*/
public function lazy($lazy = true)
{
$this->lazy = $lazy;
return $this;
}
/**
* 设置路由为测试模式
* @access public
* @param bool $test 路由是否测试模式
* @return void
*/
public function setTestMode($test)
{
$this->isTest = $test;
}
/**
* 检查路由是否为测试模式
* @access public
* @return bool
*/
public function isTest()
{
return $this->isTest;
}
/**
* 设置路由域名及分组(包括资源路由)是否合并解析
* @access public
* @param bool $merge 路由是否合并解析
* @return $this
*/
public function mergeRuleRegex($merge = true)
{
$this->mergeRuleRegex = $merge;
$this->group->mergeRuleRegex($merge);
return $this;
}
/**
* 设置路由自动解析是否搜索多级控制器
* @access public
* @param bool $auto 是否自动搜索多级控制器
* @return $this
*/
public function autoSearchController($auto = true)
{
$this->autoSearchController = $auto;
return $this;
}
/**
* 初始化默认域名
* @access protected
* @return void
*/
protected function setDefaultDomain()
{
// 默认域名
$this->domain = $this->host;
// 注册默认域名
$domain = new Domain($this, $this->host);
$this->domains[$this->host] = $domain;
// 默认分组
$this->group = $domain;
}
/**
* 设置当前域名
* @access public
* @param RuleGroup $group 域名
* @return void
*/
public function setGroup(RuleGroup $group)
{
$this->group = $group;
}
/**
* 获取当前分组
* @access public
* @return RuleGroup
*/
public function getGroup()
{
return $this->group;
}
/**
* 注册变量规则
* @access public
* @param string|array $name 变量名
* @param string $rule 变量规则
* @return $this
*/
public function pattern($name, $rule = '')
{
$this->group->pattern($name, $rule);
return $this;
}
/**
* 注册路由参数
* @access public
* @param string|array $name 参数名
* @param mixed $value 值
* @return $this
*/
public function option($name, $value = '')
{
$this->group->option($name, $value);
return $this;
}
/**
* 注册域名路由
* @access public
* @param string|array $name 子域名
* @param mixed $rule 路由规则
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return Domain
*/
public function domain($name, $rule = '', $option = [], $pattern = [])
{
// 支持多个域名使用相同路由规则
$domainName = is_array($name) ? array_shift($name) : $name;
if ('*' != $domainName && false === strpos($domainName, '.')) {
$domainName .= '.' . $this->request->rootDomain();
}
if (!isset($this->domains[$domainName])) {
$domain = (new Domain($this, $domainName, $rule, $option, $pattern))
->lazy($this->lazy)
->mergeRuleRegex($this->mergeRuleRegex);
$this->domains[$domainName] = $domain;
} else {
$domain = $this->domains[$domainName];
$domain->parseGroupRule($rule);
}
if (is_array($name) && !empty($name)) {
$root = $this->request->rootDomain();
foreach ($name as $item) {
if (false === strpos($item, '.')) {
$item .= '.' . $root;
}
$this->domains[$item] = $domainName;
}
}
// 返回域名对象
return $domain;
}
/**
* 获取域名
* @access public
* @return array
*/
public function getDomains()
{
return $this->domains;
}
/**
* 设置路由绑定
* @access public
* @param string $bind 绑定信息
* @param string $domain 域名
* @return $this
*/
public function bind($bind, $domain = null)
{
$domain = is_null($domain) ? $this->domain : $domain;
$this->bind[$domain] = $bind;
return $this;
}
/**
* 读取路由绑定
* @access public
* @param string $domain 域名
* @return string|null
*/
public function getBind($domain = null)
{
if (is_null($domain)) {
$domain = $this->domain;
} elseif (true === $domain) {
return $this->bind;
} elseif (false === strpos($domain, '.')) {
$domain .= '.' . $this->request->rootDomain();
}
$subDomain = $this->request->subDomain();
if (strpos($subDomain, '.')) {
$name = '*' . strstr($subDomain, '.');
}
if (isset($this->bind[$domain])) {
$result = $this->bind[$domain];
} elseif (isset($name) && isset($this->bind[$name])) {
$result = $this->bind[$name];
} elseif (!empty($subDomain) && isset($this->bind['*'])) {
$result = $this->bind['*'];
} else {
$result = null;
}
return $result;
}
/**
* 读取路由标识
* @access public
* @param string $name 路由标识
* @param string $domain 域名
* @return mixed
*/
public function getName($name = null, $domain = null, $method = '*')
{
return $this->app['rule_name']->get($name, $domain, $method);
}
/**
* 读取路由
* @access public
* @param string $rule 路由规则
* @param string $domain 域名
* @return array
*/
public function getRule($rule, $domain = null)
{
if (is_null($domain)) {
$domain = $this->domain;
}
return $this->app['rule_name']->getRule($rule, $domain);
}
/**
* 读取路由
* @access public
* @param string $domain 域名
* @return array
*/
public function getRuleList($domain = null)
{
return $this->app['rule_name']->getRuleList($domain);
}
/**
* 批量导入路由标识
* @access public
* @param array $name 路由标识
* @return $this
*/
public function setName($name)
{
$this->app['rule_name']->import($name);
return $this;
}
/**
* 导入配置文件的路由规则
* @access public
* @param array $rules 路由规则
* @param string $type 请求类型
* @return void
*/
public function import(array $rules, $type = '*')
{
// 检查域名部署
if (isset($rules['__domain__'])) {
foreach ($rules['__domain__'] as $key => $rule) {
$this->domain($key, $rule);
}
unset($rules['__domain__']);
}
// 检查变量规则
if (isset($rules['__pattern__'])) {
$this->pattern($rules['__pattern__']);
unset($rules['__pattern__']);
}
// 检查路由别名
if (isset($rules['__alias__'])) {
foreach ($rules['__alias__'] as $key => $val) {
$this->alias($key, $val);
}
unset($rules['__alias__']);
}
// 检查资源路由
if (isset($rules['__rest__'])) {
foreach ($rules['__rest__'] as $key => $rule) {
$this->resource($key, $rule);
}
unset($rules['__rest__']);
}
// 检查路由规则(包含分组)
foreach ($rules as $key => $val) {
if (is_numeric($key)) {
$key = array_shift($val);
}
if (empty($val)) {
continue;
}
if (is_string($key) && 0 === strpos($key, '[')) {
$key = substr($key, 1, -1);
$this->group($key, $val);
} elseif (is_array($val)) {
$this->rule($key, $val[0], $type, $val[1], isset($val[2]) ? $val[2] : []);
} else {
$this->rule($key, $val, $type);
}
}
}
/**
* 注册路由规则
* @access public
* @param string $rule 路由规则
* @param mixed $route 路由地址
* @param string $method 请求类型
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function rule($rule, $route, $method = '*', array $option = [], array $pattern = [])
{
return $this->group->addRule($rule, $route, $method, $option, $pattern);
}
/**
* 设置跨域有效路由规则
* @access public
* @param Rule $rule 路由规则
* @param string $method 请求类型
* @return $this
*/
public function setCrossDomainRule($rule, $method = '*')
{
if (!isset($this->cross)) {
$this->cross = (new RuleGroup($this))->mergeRuleRegex($this->mergeRuleRegex);
}
$this->cross->addRuleItem($rule, $method);
return $this;
}
/**
* 批量注册路由规则
* @access public
* @param array $rules 路由规则
* @param string $method 请求类型
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return void
*/
public function rules($rules, $method = '*', array $option = [], array $pattern = [])
{
$this->group->addRules($rules, $method, $option, $pattern);
}
/**
* 注册路由分组
* @access public
* @param string|array $name 分组名称或者参数
* @param array|\Closure $route 分组路由
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleGroup
*/
public function group($name, $route, array $option = [], array $pattern = [])
{
if (is_array($name)) {
$option = $name;
$name = isset($option['name']) ? $option['name'] : '';
}
return (new RuleGroup($this, $this->group, $name, $route, $option, $pattern))
->lazy($this->lazy)
->mergeRuleRegex($this->mergeRuleRegex);
}
/**
* 注册路由
* @access public
* @param string $rule 路由规则
* @param mixed $route 路由地址
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function any($rule, $route = '', array $option = [], array $pattern = [])
{
return $this->rule($rule, $route, '*', $option, $pattern);
}
/**
* 注册GET路由
* @access public
* @param string $rule 路由规则
* @param mixed $route 路由地址
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function get($rule, $route = '', array $option = [], array $pattern = [])
{
return $this->rule($rule, $route, 'GET', $option, $pattern);
}
/**
* 注册POST路由
* @access public
* @param string $rule 路由规则
* @param mixed $route 路由地址
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function post($rule, $route = '', array $option = [], array $pattern = [])
{
return $this->rule($rule, $route, 'POST', $option, $pattern);
}
/**
* 注册PUT路由
* @access public
* @param string $rule 路由规则
* @param mixed $route 路由地址
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function put($rule, $route = '', array $option = [], array $pattern = [])
{
return $this->rule($rule, $route, 'PUT', $option, $pattern);
}
/**
* 注册DELETE路由
* @access public
* @param string $rule 路由规则
* @param mixed $route 路由地址
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function delete($rule, $route = '', array $option = [], array $pattern = [])
{
return $this->rule($rule, $route, 'DELETE', $option, $pattern);
}
/**
* 注册PATCH路由
* @access public
* @param string $rule 路由规则
* @param mixed $route 路由地址
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function patch($rule, $route = '', array $option = [], array $pattern = [])
{
return $this->rule($rule, $route, 'PATCH', $option, $pattern);
}
/**
* 注册资源路由
* @access public
* @param string $rule 路由规则
* @param string $route 路由地址
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return Resource
*/
public function resource($rule, $route = '', array $option = [], array $pattern = [])
{
return (new Resource($this, $this->group, $rule, $route, $option, $pattern, $this->rest))
->lazy($this->lazy);
}
/**
* 注册控制器路由 操作方法对应不同的请求前缀
* @access public
* @param string $rule 路由规则
* @param string $route 路由地址
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleGroup
*/
public function controller($rule, $route = '', array $option = [], array $pattern = [])
{
$group = new RuleGroup($this, $this->group, $rule, null, $option, $pattern);
foreach ($this->methodPrefix as $type => $val) {
$group->addRule('<action>', $val . '<action>', $type);
}
return $group->prefix($route . '/');
}
/**
* 注册视图路由
* @access public
* @param string|array $rule 路由规则
* @param string $template 路由模板地址
* @param array $vars 模板变量
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function view($rule, $template = '', array $vars = [], array $option = [], array $pattern = [])
{
return $this->rule($rule, $template, 'GET', $option, $pattern)->view($vars);
}
/**
* 注册重定向路由
* @access public
* @param string|array $rule 路由规则
* @param string $route 路由地址
* @param array $status 状态码
* @param array $option 路由参数
* @param array $pattern 变量规则
* @return RuleItem
*/
public function redirect($rule, $route = '', $status = 301, array $option = [], array $pattern = [])
{
return $this->rule($rule, $route, '*', $option, $pattern)->redirect()->status($status);
}
/**
* 注册别名路由
* @access public
* @param string $rule 路由别名
* @param string $route 路由地址
* @param array $option 路由参数
* @return AliasRule
*/
public function alias($rule, $route, array $option = [])
{
$aliasRule = new AliasRule($this, $this->group, $rule, $route, $option);
$this->alias[$rule] = $aliasRule;
return $aliasRule;
}
/**
* 获取别名路由定义
* @access public
* @param string $name 路由别名
* @return string|array|null
*/
public function getAlias($name = null)
{
if (is_null($name)) {
return $this->alias;
}
return isset($this->alias[$name]) ? $this->alias[$name] : null;
}
/**
* 设置不同请求类型下面的方法前缀
* @access public
* @param string|array $method 请求类型
* @param string $prefix 类型前缀
* @return $this
*/
public function setMethodPrefix($method, $prefix = '')
{
if (is_array($method)) {
$this->methodPrefix = array_merge($this->methodPrefix, array_change_key_case($method));
} else {
$this->methodPrefix[strtolower($method)] = $prefix;
}
return $this;
}
/**
* 获取请求类型的方法前缀
* @access public
* @param string $method 请求类型
* @param string $prefix 类型前缀
* @return string|null
*/
public function getMethodPrefix($method)
{
$method = strtolower($method);
return isset($this->methodPrefix[$method]) ? $this->methodPrefix[$method] : null;
}
/**
* rest方法定义和修改
* @access public
* @param string $name 方法名称
* @param array|bool $resource 资源
* @return $this
*/
public function rest($name, $resource = [])
{
if (is_array($name)) {
$this->rest = $resource ? $name : array_merge($this->rest, $name);
} else {
$this->rest[$name] = $resource;
}
return $this;
}
/**
* 获取rest方法定义的参数
* @access public
* @param string $name 方法名称
* @return array|null
*/
public function getRest($name = null)
{
if (is_null($name)) {
return $this->rest;
}
return isset($this->rest[$name]) ? $this->rest[$name] : null;
}
/**
* 注册未匹配路由规则后的处理
* @access public
* @param string $route 路由地址
* @param string $method 请求类型
* @param array $option 路由参数
* @return RuleItem
*/
public function miss($route, $method = '*', array $option = [])
{
return $this->group->addMissRule($route, $method, $option);
}
/**
* 注册一个自动解析的URL路由
* @access public
* @param string $route 路由地址
* @return RuleItem
*/
public function auto($route)
{
return $this->group->addAutoRule($route);
}
/**
* 检测URL路由
* @access public
* @param string $url URL地址
* @param bool $must 是否强制路由
* @return Dispatch
* @throws RouteNotFoundException
*/
public function check($url, $must = false)
{
// 自动检测域名路由
$domain = $this->checkDomain();
$url = str_replace($this->config['pathinfo_depr'], '|', $url);
$completeMatch = $this->config['route_complete_match'];
$result = $domain->check($this->request, $url, $completeMatch);
if (false === $result && !empty($this->cross)) {
// 检测跨域路由
$result = $this->cross->check($this->request, $url, $completeMatch);
}
if (false !== $result) {
// 路由匹配
return $result;
} elseif ($must) {
// 强制路由不匹配则抛出异常
throw new RouteNotFoundException();
}
// 默认路由解析
return new UrlDispatch($this->request, $this->group, $url, [
'auto_search' => $this->autoSearchController,
]);
}
/**
* 检测域名的路由规则
* @access protected
* @return Domain
*/
protected function checkDomain()
{
// 获取当前子域名
$subDomain = $this->request->subDomain();
$item = false;
if ($subDomain && count($this->domains) > 1) {
$domain = explode('.', $subDomain);
$domain2 = array_pop($domain);
if ($domain) {
// 存在三级域名
$domain3 = array_pop($domain);
}
if ($subDomain && isset($this->domains[$subDomain])) {
// 子域名配置
$item = $this->domains[$subDomain];
} elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) {
// 泛三级域名
$item = $this->domains['*.' . $domain2];
$panDomain = $domain3;
} elseif (isset($this->domains['*']) && !empty($domain2)) {
// 泛二级域名
if ('www' != $domain2) {
$item = $this->domains['*'];
$panDomain = $domain2;
}
}
if (isset($panDomain)) {
// 保存当前泛域名
$this->request->setPanDomain($panDomain);
}
}
if (false === $item) {
// 检测当前完整域名
$item = $this->domains[$this->host];
}
if (is_string($item)) {
$item = $this->domains[$item];
}
return $item;
}
/**
* 清空路由规则
* @access public
* @return void
*/
public function clear()
{
$this->app['rule_name']->clear();
$this->group->clear();
}
/**
* 设置全局的路由分组参数
* @access public
* @param string $method 方法名
* @param array $args 调用参数
* @return RuleGroup
*/
public function __call($method, $args)
{
return call_user_func_array([$this->group, $method], $args);
}
public function __debugInfo()
{
$data = get_object_vars($this);
unset($data['app'], $data['request']);
return $data;
}
}