如何判断哪个CakePHP版本是用哪个项目制作的?

Mau*_*uan 38 php cakephp

是否可以知道用于生成仅具有应用程序代码的项目的CakePHP版本?


我的问题:

我下载了一个用CakePHP制作的项目,我真的说不出要使用的Cake版本.文件说,例如@version $Revision: 8004 $,但在某些文件中这是不同的.我应该假设最高版本(8004)是正确使用的吗?

它似乎是从2008年左右开始的,所以我猜它是一个1.x版本.

PD:是项目的代码.

小智 75

我发现从CakePHP 2.3.0开始,该版本保存在根Cake lib下的静态文件中.

bash #: cat $CAKE_ROOT/lib/Cake/VERSION.txt

////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// CakePHP Version
//
// Holds a static string representing the current version of CakePHP
//
// CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
// Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
//
// Licensed under The MIT License
// Redistributions of files must retain the above copyright notice.
//
// @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
// @link          http://cakephp.org
// @package       cake.libs
// @since         CakePHP(tm) v 0.2.9
// @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
2.3.0
Run Code Online (Sandbox Code Playgroud)

  • 真是太神奇了!我刚刚发现本地环境中的蛋糕版本与开发环境不同!你解决了我的问题,这个问题已经花费了我大约 1 周的时间!多谢! (2认同)

Cos*_*sta 24

编辑core.php,添加到顶部:

echo Configure::version();
Run Code Online (Sandbox Code Playgroud)

  • 他只有应用程序源代码.所以这只会告诉他他正在尝试运行它的Cake版本.不是它的用途. (2认同)

tar*_*l05 15

对于cakephp 3.x,找到\ vendor\cakephp\cakephp\VERSION.txt

在此输入图像描述

////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// CakePHP Version
//
// Holds a static string representing the current version of CakePHP
//
// CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
// Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
//
// Licensed under The MIT License
// Redistributions of files must retain the above copyright notice.
//
// @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
// @link          http://cakephp.org
// @since         CakePHP(tm) v 0.2.9
// @license       http://www.opensource.org/licenses/mit-license.php MIT License
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
3.3.2
Run Code Online (Sandbox Code Playgroud)


Con*_*sed 9

简单方法:只搜索VERSION.txt文件.打开它来检查版本.

version.txt的路径

对于cakephp 1.*:cake/VERSION.txt

对于cakephp 2.*:lib/Cake/VERSION.txt

对于cakephp 3.* :vendor/cakephp/cakephp/VERSION.txt