我在 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/