首頁  >  文章  >  後端開發  >  處理 PHP 開發版本問題

處理 PHP 開發版本問題

藏色散人
藏色散人轉載
2020-12-02 15:19:263662瀏覽
在安裝一個開源專案時,作者本地用了PHP 7.1 進行開發,而我本地是PHP 7.0, 於是悲劇發生了,出現了這樣的錯誤:requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement..

一、Composer 安裝套件

composer install 之後報錯

vagrant@homestead:~/Code/sample$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
    - doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement.
  Problem 2
    - doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement.
    - phpunit/phpunit-mock-objects 2.3.8 requires doctrine/instantiator ^1.0.2 -> satisfiable by doctrine/instantiator[1.1.0].
    - Installation request for phpunit/phpunit-mock-objects 2.3.8 -> satisfiable by phpunit/phpunit-mock-objects[2.3.8].

二、解決方法

#刪除composer.lock 文件,重新執行composer install,這樣就能重新產生composer.lock 文件了。

composer 套件自動載入後,會產生一個 composer.lock 鎖定文件,所以,在從GitHub拉取別人的程式碼後,需要對這個文件進行刪除。

推薦:《PHP影片教學

以上是處理 PHP 開發版本問題的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:segmentfault.com。如有侵權,請聯絡admin@php.cn刪除