我是 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
>/p>
关于php - 问题安装 prestashop 模块 : mymodule(class missing in/. ..),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35128599/