17 lines
547 B
PHP
17 lines
547 B
PHP
<?php
|
|
/**
|
|
* Here is your custom functions.
|
|
*/
|
|
|
|
/**
|
|
* mb_split 兼容:当 PHP 未启用 mbstring 或 mb_split 不可用时,用 preg_split 模拟
|
|
* 解决 Illuminate\Support\Str::studly() 在 Windows 等环境下报 Call to undefined function mb_split() 的问题
|
|
*/
|
|
if (!function_exists('mb_split')) {
|
|
function mb_split(string $pattern, string $string, int $limit = -1): array
|
|
{
|
|
$regex = '/' . str_replace('/', '\\/', $pattern) . '/u';
|
|
return preg_split($regex, $string, $limit === -1 ? -1 : $limit) ?: [];
|
|
}
|
|
}
|