简体   繁体   English

PrestaShop模块中的命名空间

[英]Namespace in a PrestaShop module

I'm creating a prestashop module that must be validated here : https://validator.prestashop.com . 我正在创建一个必须在此处进行验证的prestashop模块: https : //validator.prestashop.com

I'm using an LGPL library , based on namespaces . 我正在使用基于名称空间的LGPL库。 Unfortunately all the classes in the namespace file is not found by the validator. 不幸的是,验证程序未找到名称空间文件中的所有类。 The error : Class ' Httpful \\ Handlers \\ JsonHandler ' does not exists. 错误:类'Httpful \\ Handlers \\ JsonHandler'不存在。

There is a best practice to recognize the classes? 有识别这些班级的最佳实践吗?

Unfortunately Prestashop still can't handle namespaces, one of ways how to fix it: 不幸的是,Prestashop仍然无法处理名称空间,这是解决它的方法之一:

In the module main file mymodule.php 在模块主文件mymodule.php中

include 'actualcode.php'

in actualcode.php - the module real code, with namespaces etc. actualcode.php中 -模块实际代码,带有名称空间等。

It works in Prestashop installation, I'm not sure about validator. 它可以在Prestashop安装中使用,我不确定验证程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM