1

Ive got my module config

app/code/SET/HelloWorld/etc.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
    
    <router id="standard">
    
        <route id="helloworld" frontName="helloworld">
    
            <module name="SET_HelloWorld" />
    
        </route>
    
    </router>
    
</config>
       

And added it in etc/config.php:

'SET_HelloWorld' => 1,

But after running bin/magento setup:upgrade The key in te config.php array is gone.

Could someone tell me why?

4

1 回答 1

2

我发现我错过了 Registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'SET_HelloWorld',
    __DIR__
);

如果模块未注册,magento 会自动将其从 config.php 数组中删除。

此注册是最近添加的,在很多在线教程中都找不到

于 2015-12-11T15:07:59.797 回答