安装prestashop模块时出现问题:mymodule(/..中缺少类)


Issue installing prestashop module : mymodule(class missing in /...)

我是prestashop模块开发的新手,我似乎无法让它工作。我一步一步地按照教程进行操作,但是当我安装模块时,我总是得到这个"Mymodule(/modules/Mymodule/test-module.php中缺少类)"。

我在网上检查了一下,当 php 文件没有在没有 BOM 的情况下以 UTF-8 编码时,似乎会发生此错误,但即使这样做也不起作用。

这是我的代码,希望有人发现问题所在:

<?php
if (!defined('_PS_VERSION_'))
exit;
class CookiesPresta extends Module {
  public function __construct() {
   $this->name = 'CookiesPresta';
   $this->tab = 'front_office_features';
   $this->version = '1.0';
   $this->author = 'me myself';
   $this->need_instance = 0;
   $this->ps_versions_compliancy = array('min' => '1.5');
   $this->dependencies = array();
   parent::__construct();
   $this->displayName = $this->l('Bandeau Cookies');
   $this->description = $this->l('Créez et personnalisez votre bandeau d''information sur les cookies');
$this->confirmUninstall = $this->l('Voulez vous désinstaller le module Bandeau Cookies');
if (!Configuration::get('cookiespresta'))      
  $this->warning = $this->l('No name provided');
}

public function install() {
 if (!parent::install()
        || !$this->registerHook('displayHeader')
        || !$this->registerHook('displayFooter')
    )
        return false;
    return true;
}
public function uninstall() {
   if(parent::uninstall())
      return false;
 return true;
}
}
?>

如果你的模块是类名CookiesPresta你应该将目录命名为/cookiespresta,你的类文件/cookiespresta/cookiespresta.php

我建议你使用Prestashop的生成器创建一个标准模块