Call to undefined function Termwind\ValueObjects\mb_strimwidth()
1、报错:Call to undefined function Termwind\ValueObjects\mb_strimwidth()。如图1
PS E:\object> php artisan db:seed
INFO Seeding database.
Error
Call to undefined function Termwind\ValueObjects\mb_strimwidth()
at E:\object\vendor\nunomaduro\termwind\src\ValueObjects\Styles.php:1053
1049▕ */
1050▕ private static function trimText(string $text, int $width): string
1051▕ {
1052▕ preg_match_all(self::STYLING_REGEX, $text, $matches, PREG_OFFSET_CAPTURE);
➜ 1053▕ $text = rtrim(mb_strimwidth(preg_replace(self::STYLING_REGEX, '', $text) ?? '', 0, $width, '', 'UTF-8'));
1054▕
1055▕ foreach ($matches[0] ?? [] as [$part, $index]) {
1056▕ $text = substr($text, 0, $index).$part.substr($text, $index, null);
1057▕ }
1 E:\object\vendor\nunomaduro\termwind\src\ValueObjects\Styles.php:870
Termwind\ValueObjects\Styles::trimText("...........................................................................................................................................................................")
2 E:\object\vendor\nunomaduro\termwind\src\ValueObjects\Styles.php:733
Termwind\ValueObjects\Styles::applyWidth("...........................................................................................................................................................................")
2、在 php.ini 中取消注释。extension=mbstring
3、不再报错。如图2


近期评论