- 問(wèn)題:安裝
php artisan breeze:install
時(shí)出現(xiàn)以下錯(cuò)誤。
Call to undefined function Termwind\ValueObjects\mb_strimwidth()
問(wèn)題就是:mb_strimwidth()不能識(shí)別屿聋,那么就解決寬字符問(wèn)題咧欣,就能解決。
php artisan breeze:install
Which Breeze stack would you like to install?
Error
Call to undefined function Termwind\ValueObjects\mb_strimwidth()
at 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 vendor\nunomaduro\termwind\src\ValueObjects\Styles.php:870
Termwind\ValueObjects\Styles::trimText("..................................................................................................................................")
2 vendor\nunomaduro\termwind\src\ValueObjects\Styles.php:733
Termwind\ValueObjects\Styles::applyWidth("..................................................................................................................................")
- 查看一下版本:
php --version
PHP 8.3.1 (cli) (built: Dec 20 2023 14:06:10) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.1, Copyright (c) Zend Technologies
- 因此解決:對(duì)應(yīng)版本的php.ini中枉疼,添加:
extension=php_mbstring.dll
皮假。支持寬字符串,問(wèn)題就應(yīng)該得到解決骂维。參考配置如下:
[Date]
date.timezone=Asia/Shanghai
[PHP]
max_execution_time = 300
max_input_time=60
max_input_vars=3000
memory_limit=256M
upload_max_filesize = 100M
post_max_size = 100M
max_file_uploads = 100
display_errors = On
display_startup_errors=On
log_errors=On
track_errors=Off
html_errors=On
error_log=C:/phpstudy_pro/Extensions/php/php-8.3.1-Win32-vs16-x64.log
error_reporting=E_ALL & ~E_NOTICE
allow_url_fopen=On
allow_url_include=Off
extension_dir="C:\phpstudy_pro\Extensions\php\php-8.3.1-Win32-vs16-x64\ext"
extension=php_pdo_mysql
extension=php_openssl.dll
extension=php_mbstring.dll
extension=zip
extension=curl
variables_order = "GPCS"
extension=php_fileinfo
- 經(jīng)過(guò)測(cè)試惹资,加入
extension=php_mbstring.dll
后,再次執(zhí)行結(jié)果如下:
php artisan breeze:install
Which Breeze stack would you like to install?
Blade with Alpine ...................................................................................................... blade
Livewire (Volt Class API) with Alpine ............................................................................... livewire
Livewire (Volt Functional API) with Alpine ............................................................... livewire-functional
React with Inertia ..................................................................................................... react
Vue with Inertia ......................................................................................................... vue
API only ................................................................................................................. api
?
至此航闺,問(wèn)題成功解決褪测。