我需要在我的mac上使用扩展intl和XAMPP.
所以我按照这个链接:
在XAMPP for Mac Lion 10.8上安装Php-intl
http://lvarayut.blogspot.it/2013/09/installing-intl-extension-in-xampp.html
我重新启动我的apache服务器,但没有安装扩展.因为如果我发布:
php -m | grep intl #should return 'intl'
Run Code Online (Sandbox Code Playgroud)
回来空了
没有它我无法启动的命令是对于composer和cakephp这样:
composer create-project --prefer-dist -s dev cakephp/app cakephp3
Run Code Online (Sandbox Code Playgroud)
给我这个错误:
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for cakephp/cakephp 3.0.*-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
Problem 2
- cakephp/cakephp 3.0.x-dev requires ext-intl * …Run Code Online (Sandbox Code Playgroud) 我想将0.45格式化为45%.
我知道我可以做类似的事情FLOOR($x*100).'%',但想知道是否有更好的方法(更好的定义为更标准,而不一定更快).
一个想法是http://php.net/manual/en/class.numberformatter.php.这是一个更好的方法吗?有没有人用它,你能展示一个例子吗?谢谢
我尝试安装沙箱但是我从composer得到以下错误:
使用包信息加载composer存储库从锁定文件安装依赖项无法将您的需求解析为可安装的软件包集.
问题1
- Installation request for sonata-project/intl-bundle 2.1.0 -> satisfiable by sonata-project/intl-bundle 2.1.0.`
- sonata-project/intl-bundle 2.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.`
Run Code Online (Sandbox Code Playgroud)
问题2
- sonata-project/intl-bundle 2.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.`
- sonata-project/news-bundle 2.1.x-dev requires sonata-project/intl-bundle 2.1.* -> satisfiable by sonata-project/intl-bundle 2.1.0.
- Installation request for sonata-project/news-bundle 2.1.
Run Code Online (Sandbox Code Playgroud) 我有一个简单的PHP程序,但我遇到这个错误:
未找到"NumberFormatter"类
我已经在Stackoverflow中研究过类似的问题,但老实说没有人给出具体的解决方案.其他人建议升级PHP的版本,其他人则取消对php.ini文件中特定行的注释,但这些都不适用于我.
下面是我的代码:我甚至使用了https://bugs.php.net建议的解决方案,但它仍然不起作用.
<!DOCTYPE html>
<html>
<body>
<?php
function writeMsg(){
$f = new \NumberFormatter("en", \NumberFormatter::SPELLOUT);
echo $f->format(1432);
}
writeMsg();
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 PHP 的 intl 扩展名将数量转换为单词。例如,
第1450章一千四百五十
我正在使用 Laravel 5.4,它在带有 PHP 5.6.24 的 XAMPP 3.2.2 服务器上运行。
正如在类似问题中提到的,我已经intl通过取消注释extension=ext/php_intl.dllPHP.ini 文件中的行来启用PHP 扩展,然后重新启动我的服务器。
$inWords = new \NumberFormatter('en', \NumberFormatter::SPELLOUT);
echo $inWords->format(1450);
Run Code Online (Sandbox Code Playgroud)
产生错误:
FatalErrorException:未找到“NumberFormatter”类
我猜这与 Laravel 无关,但与 PHP 无关。有谁知道问题的解决方案?谢谢你的时间。
php ×6
intl ×2
apache ×1
cakephp ×1
laravel ×1
laravel-5.4 ×1
macos ×1
symfony ×1
windows-xp ×1