我已经在magento中创建了一个自定义模块,我希望它只能由管理员访问。
模块结构如下: - 在 / app / code / local / Mage / Customerfriends
中控制器/ IndexController.php
class Mage_Customerfriends_IndexController extends Mage_Adminhtml_Controller_Action
{
public function exportAction()
{
echo 'working';
}
}
等/ config.xml中
<?xml version="1.0"?>
<config>
<modules>
<Mage_Customerfriends>
<version>0.1.0</version> <!-- Version number of your module -->
</Mage_Customerfriends>
</modules>
<admin>
<routers>
<customerfriends>
<use>admin</use>
<args>
<module>Mage_Customerfriends</module>
<frontName>customerfriends</frontName>
</args>
</customerfriends>
</routers>
</admin>
</config>
应用的/ etc /模块/ Mage_Customerfriends.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Mage_Customerfriends>
<active>true</active>
<codePool>local</codePool>
</Mage_Customerfriends>
</modules>
</config>
现在,当我尝试访问此控制器时,我收到404错误。
网址 example.com/index.php/admin/customerfriends/index/export/key/abcdef