php - 如何使用 Laravel 5.6 升级 Carbon?

标签 php laravel composer-php php-carbon

我在 cmd 中试过“composer 需要 nesbot/carbon”,但我得到了这个:

Your requirements could not be resolved to an installable set of packages.

  Problem 1

    - laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
    - laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
    - laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
    - Installation request for laravel/framework (locked at v5.6.27, required as 5.6.*) -> satisfiable by laravel/framework[v5.6.27].


Installation failed, reverting ./composer.json to its original content.

最佳答案

我不建议在没有极度谨慎的情况下执行此操作,因为 Laravel 或您的任何其他依赖项可能需要非常严格的包版本。

话虽如此,Composer 确实包含了一个巧妙的别名版本技巧,可以通过在 composer.json 中指定别名版本来解决这个问题。 :

"require": {
    ...
    "nesbot/carbon": "1.32.0 as 1.25.0"
},

请注意 as 1.25.0这会诱使其他软件包思考 1.32.0相当于 1.25.0对于依赖项。这个技巧需要精确的版本。

关于php - 如何使用 Laravel 5.6 升级 Carbon?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51332201/

相关文章:

php - Laravel MySQL SQLSTATE[HY000] [2002] 连接被拒绝

php - Symfony 应用程序中的 Doctrine 实体和业务逻辑

php - 使用 PHP 从 CSV 导入的数据破坏了隐藏字符

php - Ubuntu 16 中缺少 php_soap.dll

php - 在没有 XAMPP 的情况下在 Windows 中安装 Laravel

cakephp - 更新 Cakephp3 应用程序核心库的推荐方法是什么

php - 记录根据表数据列出不正确的结果 Mysql

php - 如何使用 NetBeans 和 x-debug 查看长字符串的值?

javascript - 如何获取包含每行值总和的总列

laravel - 尽管加载了扩展程序,但仍出现 'Please make sure the PHP Redis extension is installed and enabled.' 错误