helper.php 525 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * 添加自定义辅助函数
  4. */
  5. if ( ! function_exists('config_path'))
  6. {
  7. /**
  8. * Get the configuration path.
  9. *
  10. * @param string $path
  11. * @return string
  12. */
  13. function config_path($path = '')
  14. {
  15. return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
  16. }
  17. function subtext($text, $length)
  18. {
  19. if(mb_strlen($text, 'utf8') > $length) {
  20. return mb_substr($text, 0, $length, 'utf8').'...';
  21. } else {
  22. return $text;
  23. }
  24. }
  25. }