我的代码存在问题
class Crop
{
const TYPE = ['main_crop', 'detail_crop', 'common_crop', 'list_crop'];
}
var_dump(Crop::TYPE);
问题是我的PHP版本低于5.6 我设法通过升级来修复它。
所以php -i
正在给我PHP Version => 7.0.16-4+deb.sury.org~trusty+1
。
现在我有一台服务器正在运行。使用phpinfo()
我回复PHP Version 5.5.9-1ubuntu4.21
,因此我上面的代码无效。
我正在使用Laravel并使用命令composer upgrade
,composer install
没有安装新的php版本。我放入"php":"xxx"
的版本无关紧要。
composer.json:
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.0",
"laravel/lumen-framework": "5.2.*",
"vlucas/phpdotenv": "~2.2",
"venturecraft/revisionable": "^1.27",
"doctrine/dbal": "^2.5",
"nicolaslopezj/searchable": "^1.9",
"sofa/eloquence": "^5.2",
"intervention/image": "^2.3",
"ivanlemeshev/laravel5-cyrillic-slug": "^1.0",
"guzzlehttp/guzzle": "~6.0",
"sngrl/sphinxsearch": "dev-master",
"graylog2/gelf-php": "^1.5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~4.0"
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Helpers/Helper.php"
]
},
"autoload-dev": {
"classmap": [
"tests/",
"database/"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
]
}
}
我做错了什么?