Route.php 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app;
  12. use think\route\Url as UrlBuild;
  13. class Route extends \think\Route
  14. {
  15. /**
  16. * URL生成 支持路由反射
  17. * @access public
  18. * @param string $url 路由地址
  19. * @param array $vars 参数 ['a'=>'val1', 'b'=>'val2']
  20. * @return UrlBuild
  21. */
  22. public function buildUrl(string $url = '', array $vars = []): UrlBuild
  23. {
  24. $str = substr($url, 0, 1);
  25. if ($str != '/') $url = '/' . $url;
  26. return parent::buildUrl($url, $vars);
  27. }
  28. }