字符串操作工具

字符串操作工具类主要存放字符串常用的函数

内置方法

获取当前路由控制器方法组合成的字符串

public static function getAuthName(string $action, string $controller, string $module, $route)

根据参数转换成字符串

public static function paramStr($params)

paramStr配合getAuthName使用 使用示例

use crmeb\utils\Str;

$action = 'index';
$controller = 'index';
$module = 'admin';
$route = ['page' => 1];

$res = Str::getAuthName($action, $controller, $module, $route);

var_dump($res);

截取中文指定字节

public static function substrUTf8($str, $utf8len = 100, $chaet = 'UTF-8', $file = '....')

使用示例

use crmeb\utils\Str;

$str = '中国人民共和国,是最好的国家之一。';

$res = Str::substrUTf8($str, 10);

var_dump($res);
本页目录