ThinkPHP8.0的环境要求如下:
- PHP >= 8.0.0
查看当前版本
PHP版本
Lenovo@LAPTOP-0TNC2OPB MINGW64 /d/phpstudy_pro/WWW/dadan (main)
$ php think -v
version 8.0.2
ThinkPHP版本
Lenovo@LAPTOP-0TNC2OPB MINGW64 /d/phpstudy_pro/WWW/dadan (main)
$ php think -v
version 6.1.4
过渡升级
升级到当前版本的最新版本
$ composer update topthink/framework
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
> @php think service:discover
Succeed!
> @php think vendor:publish
File D:\phpstudy_pro\WWW\dadan\config\trace.php exist!
Succeed!
4 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
升级
修改配置
修改 composer.json 删除composer.lock
"require": {
"php": ">=8.0.0",
"topthink/framework": "^8.0",
"topthink/think-orm": "^3.0",
"topthink/think-filesystem": "^2.0",
"topthink/think-multi-app": "^1.0"
},
"require-dev": {
"symfony/var-dumper": "^4.2",
"topthink/think-trace":"^1.0"
},
运行
composer install
$ composer install
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 16 installs, 0 updates, 0 removals
- Locking league/flysystem (2.5.0)
- Locking league/mime-type-detection (1.13.0)
- Locking psr/container (2.0.2)
- Locking psr/http-message (1.1)
- Locking psr/log (3.0.0)
- Locking psr/simple-cache (3.0.0)
- Locking symfony/polyfill-mbstring (v1.28.0)
- Locking symfony/polyfill-php72 (v1.28.0)
- Locking symfony/polyfill-php80 (v1.28.0)
- Locking symfony/var-dumper (v4.4.47)
- Locking topthink/framework (v8.0.2)
- Locking topthink/think-filesystem (v2.0.2)
- Locking topthink/think-helper (v3.1.6)
- Locking topthink/think-multi-app (v1.0.17)
- Locking topthink/think-orm (v3.0.13)
- Locking topthink/think-trace (v1.6)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 3 installs, 5 updates, 0 removals
- Installing league/mime-type-detection (1.13.0): Extracting archive
- Upgrading psr/container (1.1.2 => 2.0.2): Extracting archive
- Upgrading psr/simple-cache (1.0.1 => 3.0.0): Extracting archive
- Upgrading psr/log (1.1.4 => 3.0.0): Extracting archive
- Upgrading topthink/think-orm (v2.0.61 => v3.0.13): Extracting archive
- Upgrading topthink/framework (v6.1.4 => v8.0.2): Extracting archive
- Installing league/flysystem (2.5.0): Extracting archive
- Installing topthink/think-filesystem (v2.0.2): Extracting archive
2 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
> @php think service:discover
Succeed!
> @php think vendor:publish
File D:\phpstudy_pro\WWW\dadan\config\trace.php exist!
Succeed!
6 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
查看
Lenovo@LAPTOP-0TNC2OPB MINGW64 /d/phpstudy_pro/WWW/dadan (main)
$ composer show
league/flysystem 2.5.0 File storage abstraction for PHP
league/mime-type-detection 1.13.0 Mime-type detection for Flysystem
psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11)
psr/http-message 1.1 Common interface for HTTP messages
psr/log 3.0.0 Common interface for logging libraries
psr/simple-cache 3.0.0 Common interfaces for simple caching
symfony/polyfill-mbstring v1.28.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.28.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php80 v1.28.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/var-dumper v4.4.47 Provides mechanisms for walking through any arbitrary PHP variable
topthink/framework v8.0.2 The ThinkPHP Framework.
topthink/think-filesystem v2.0.2 The ThinkPHP6.1 Filesystem Package
topthink/think-helper v3.1.6 The ThinkPHP6 Helper Package
topthink/think-multi-app v1.0.17 thinkphp multi app support
topthink/think-orm v3.0.13 the PHP Database&ORM Framework
topthink/think-trace v1.6 thinkphp debug trace
Lenovo@LAPTOP-0TNC2OPB MINGW64 /d/phpstudy_pro/WWW/dadan (main)
$ php think -v
version 8.0.2