Magento - 创建不需要密钥的 AJAX 端点
Magento - Create AJAX endpoint that does not require a key
我正在尝试在 Magento 中创建可以从外部访问的端点。所以我在我的模块控制器中有这个
public function jsonAction()
{
$json = json_encode(['test' => 'test']);
$this->getResponse()->setHeader('Content-type', 'application/json');
$this->getResponse()->setBody($json);
}
如果我使用下面的
$test = Mage::helper("adminhtml")->getUrl("test/test/json");
它生成一个 url,末尾有一个键,然后是 url,如下所示:
http://test.app/index.php/test/test/json/key/b4070b1261af163467793da673a4df4a/
这按预期工作并返回 JSON。
问题是我需要可以从无法生成密钥的外部站点访问,所以我试图让它与
一起工作
http://test.app/index.php/test/test/json
如有任何帮助,我们将不胜感激
磁电机模块config.xml
<routers>
<test>
<use>admin</use>
<args>
<module>Test</module>
<frontName>test</frontName>
</args>
</test>
</routers>
我通过创建 SOAP 端点解决了这个问题,在安装扩展时我创建了一个具有正确角色的 Soap 用户来使用端点
我正在尝试在 Magento 中创建可以从外部访问的端点。所以我在我的模块控制器中有这个
public function jsonAction()
{
$json = json_encode(['test' => 'test']);
$this->getResponse()->setHeader('Content-type', 'application/json');
$this->getResponse()->setBody($json);
}
如果我使用下面的
$test = Mage::helper("adminhtml")->getUrl("test/test/json");
它生成一个 url,末尾有一个键,然后是 url,如下所示:
http://test.app/index.php/test/test/json/key/b4070b1261af163467793da673a4df4a/
这按预期工作并返回 JSON。
问题是我需要可以从无法生成密钥的外部站点访问,所以我试图让它与
一起工作http://test.app/index.php/test/test/json
如有任何帮助,我们将不胜感激
磁电机模块config.xml
<routers>
<test>
<use>admin</use>
<args>
<module>Test</module>
<frontName>test</frontName>
</args>
</test>
</routers>
我通过创建 SOAP 端点解决了这个问题,在安装扩展时我创建了一个具有正确角色的 Soap 用户来使用端点