如何知道 Laravel 版本以及它在哪里定义?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44637811/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to know Laravel version and where is it defined?
提问by Dims
How to know Laravel version and where is it defined?
如何知道 Laravel 版本以及它在哪里定义?
Is Laravel version is defined inside my application directory or somewhere in global server side directory?
Laravel 版本是在我的应用程序目录中还是在全局服务器端目录中定义的?
UPDATE
更新
Sorry, the main question is where the version is defined? Where does
抱歉,主要问题是版本在哪里定义的?在哪里
php artisan --version
takes it's answer?
需要它的答案?
UPDATE 2
更新 2
The goal is to investigate, who (of us) has changed Laravel version on our site. Could it be changed by github repository edition only? Or server write access was also required?
目标是调查(我们中的)谁更改了我们网站上的 Laravel 版本。只能通过github存储库版本更改吗?或者还需要服务器写访问权限?
回答by
run php artisan --version
from your console.
php artisan --version
从您的控制台运行。
The version string is defined here:
版本字符串在此处定义:
https://github.com/laravel/framework/blob/master/src/Illuminate/Foundation/Application.php
https://github.com/laravel/framework/blob/master/src/Illuminate/Foundation/Application.php
/**
* The Laravel framework version.
*
* @var string
*/
const VERSION = '5.5-dev';
回答by ankit patel
If you want to know the specific version then you need to check composer.lock file and search For
如果你想知道具体的版本,那么你需要检查 composer.lock 文件并搜索
"name": "laravel/framework",
"name": "laravel/框架",
you will find your version in next line
你会在下一行找到你的版本
"version": "v5.7.9",
"版本": "v5.7.9",
回答by Parth kharecha
1) php artisan -V
2) php artisan --version
AND its define at the composer.jsonfile
及其在composer.json文件中的定义
"require": {
...........
"laravel/framework": "5.8.*",
...........
},
回答by Vikash
If you want to know the user version in your code, then you can use using app()
helper function
如果您想知道代码中的用户版本,则可以使用 using app()
helper 函数
app()->version();
It is defined in this file ../src/Illuminate/Foundation/Application.php
它在这个文件中定义 ../src/Illuminate/Foundation/Application.php
Hope it will help :)
希望它会有所帮助:)
回答by Bart?omiej Sobieszek
Yet another way is to read the composer.json file, but it can end with wildcard character *
另一种方法是读取 composer.json 文件,但它可以以通配符结尾 *
回答by Stan Quinn
In your Laravel deployment it would be
在您的 Laravel 部署中,它将是
/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
to see who changed your Laravel version look at what's defined in composer.json. If you have "laravel/framework": "5.4.*", then it will update to the latest after composer update is run. Composer.lock is the file that results from running a composer update, so really see who last one to modify the composer.json file was (hopefully you have that in version control). You can read more about it here https://getcomposer.org/doc/01-basic-usage.md
要查看谁更改了您的 Laravel 版本,请查看 composer.json 中的定义。如果你有 "laravel/framework": "5.4.*",那么它会在 composer update 运行后更新到最新的。Composer.lock 是运行 Composer 更新后生成的文件,因此请查看最后一个修改 composer.json 文件的人是谁(希望您在版本控制中有该文件)。你可以在这里阅读更多关于它的信息https://getcomposer.org/doc/01-basic-usage.md
回答by Jyotirmoy Bhattacharjee
回答by Knc MoBo
Run this command in your project folder location in cmd
在 cmd 中的项目文件夹位置运行此命令
php artisan --version