magento2开发Api接口实例
Vue项目所用的Magento2 Api文档 Api模块文件结构: magento2 接口流程: 1、访问接口地址:http://m2.olightstore.us/rest/default/V1/olightApi/abtest 2、指向/OlightApi/Api/AbtestInterface.php接口文件 3、由于di.xml和webapi.xml配置,所以会转向/OlightApi/Model/Abtest.php文件 一、模块配置-etc/ module.xml 模块配置 – etc/module.xml <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Silk_OlightApi" setup_version="0.0.1"> </module> </config> 二、注册模块r egistration .php <?php \Magento\Framework\Component\ComponentRegistrar: