在Prestashop中获取模块版本
我有一个模块安装在我的Prestashop上,我想得到它的版本 如何在代码中实现这一点 比如说,我想得到“v5.0.1”在Prestashop中获取模块版本,prestashop,Prestashop,我有一个模块安装在我的Prestashop上,我想得到它的版本 如何在代码中实现这一点 比如说,我想得到“v5.0.1” 谢谢你的帮助 在模块文件中设置的版本如下: public function __construct() { $this->name = 'bienvenue'; $this->version = '5.0.1'; parent::__construct(); /* Else code... */ } 在模块文件中设置的版本如
谢谢你的帮助 在模块文件中设置的版本如下:
public function __construct()
{
$this->name = 'bienvenue';
$this->version = '5.0.1';
parent::__construct();
/* Else code... */
}
在模块文件中设置的版本如下:
public function __construct()
{
$this->name = 'bienvenue';
$this->version = '5.0.1';
parent::__construct();
/* Else code... */
}
非常感谢。如果您能提供帮助,还有一个问题:我想在自定义模块中使用它。因此,我扩展了模块类:“MyModule扩展模块”。在我的项目中,我还有一个类需要获取MyModule的版本。所以我必须这么做:MyModule::getInstanceByName(“MyModule”)?不客气。在您的模块(mymodule.php)中,为了检查自身版本,请使用“echo$this->version”;在其他模块(etcmodule.php)或任何其他地方,请使用上述方式:“$module=module::getInstanceByName('mymodule');echo$module->version;”我建议您不需要硬编码模块名称,而是可以通过
$this->module->name
访问它,也不需要调用module::getInstanceByName()
而是访问$this->module
。谢谢!如果您能提供帮助,还有一个问题:我想在自定义模块中使用它。因此,我扩展了模块类:“MyModule扩展模块”。在我的项目中,我还有一个类需要获取MyModule的版本。所以我必须这么做:MyModule::getInstanceByName(“MyModule”)?不客气。在您的模块(mymodule.php)中,为了检查自身版本,请使用“echo$this->version”;在其他模块(etcmodule.php)或任何其他地方,请使用上述方式:“$module=module::getInstanceByName('mymodule');echo$module->version;”我建议您不需要硬编码模块名称,而是可以通过$this->module->name
访问它,也不需要调用module::getInstanceByName()
而是访问$this->module
。