php 如何解决问题 - 请安装“intl”扩展以获得完整的本地化功能

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26602923/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 22:58:09  来源:igfitidea点击:

How to solve the issue - please install the "intl" extension for full localization capabilities

phpsymfonyintl

提问by user2818060

What i Need

我需要的

The code i have implemented:

我已经实现的代码:

use Symfony\Component\Intl\Intl;

\Locale::setDefault('en');
$currencies = Intl::getCurrencyBundle()->getCurrencyNames();

$currency = Intl::getCurrencyBundle()->getCurrencyName('INR');

$symbol = Intl::getCurrencyBundle()->getCurrencySymbol('INR');

$fractionDigits = Intl::getCurrencyBundle()->getFractionDigits('INR');

$roundingIncrement = Intl::getCurrencyBundle()->getRoundingIncrement('INR');

Error:

错误:

The Symfony\Component\Intl\Locale\Locale::setDefault() is not implemented. Please install the "intl" extension for full localization capabilities.

500 Internal Server Error - MethodNotImplementedException

Symfony\Component\Intl\Locale\Locale::setDefault() 没有实现。请安装“intl”扩展以获得完整的本地化功能。

500 内部服务器错误 - MethodNotImplementedException

OS configuration:

操作系统配置:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.04
DISTRIB_CODENAME=raring
DISTRIB_DESCRIPTION="Ubuntu 13.04"
NAME="Ubuntu"
VERSION="13.04, Raring Ringtail"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 13.04"
VERSION_ID="13.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

回答by Michael Sivolobov

You need just put one line to the terminal:

你只需要在终端上放一行:

sudo apt-get install php5-intl

回答by Dung

If you are using XAMPP on windows here is how:

如果您在 Windows 上使用 XAMPP,方法如下:

open for example c:\xampp\php\php.ini and remove the semi colon ";" in front of "extension=php_intl.dll" save the file and restart apache.

打开例如 c:\xampp\php\php.ini 并删除分号“;” 在“extension=php_intl.dll”前面保存文件并重启apache。

That will get solve the error message.

这将解决错误消息。

Done.

完毕。

回答by Azhar Khattak

Extending the Answer by Michael Sivolobov, for php7 on debian 9 /stretch

Michael Sivolobov为 debian 9 /stretch 上的 php7扩展答案

sudo apt-get install php7.0-intl

or simply

或者干脆

sudo apt-get install php-intl

then

然后

sudo service apache2 restart

Thanks!

谢谢!

回答by Evgeny Melnikov

When I tried to install intlon Ubuntu 16.04 with:

当我尝试在 Ubuntu 16.04 上安装intl时:

sudo apt-get install php5-intl

I've got an error like:

我有一个错误,如:

error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works. ERROR: `/tmp/pear/temp/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' failed

错误:无法检测 ICU 前缀或没有失败。请验证 ICU 安装前缀并确保 icu-config 有效。错误:`/tmp/pear/temp/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' 失败

In order to solve the problem I needed to install:

为了解决我需要安装的问题:

sudo apt-get install libicu-dev

and after that install

然后安装

sudo apt-get install php5-intl

That solved my problem.

那解决了我的问题。