- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了一个 shopware6 插件,其中包含一个前端自定义路由,该路由应该能够接收来自 ExactOnline 的 POST 请求。
但是当我使用 Postman 进行一些测试时,我收到“405 Method Not allowed”。这是我的 Controller :
<?php
namespace Emakers\TransmissionPlugin\Controller;
//use Emakers\TransmissionPlugin\Controller\Frontend\Services\ExactRequirements;
use Shopware\Core\Framework\Routing\Annotation\RouteScope;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Controller\StorefrontController;
use Symfony\Component\Routing\Annotation\Route;
/**
* @RouteScope(scopes={"storefront"})
*/
class AccountsController extends StorefrontController
{
/**
* @Route("/accounts", name="frontend.accounts", options={"seo"="false"}, methods={"POST"})
*/
public function accounts()
{
die('ok boy');
$file = 'custom/plugins/TransmissionPlugin/Resources/webhooks/accountWebhook.txt';
}
}
当我用 methods={"GET"} 替换 methods={"POST"} 时,相同的测试请求返回正常的“ok boy”。
我已经在 Shopware5 中创建了一个这样的插件,并且 GET 和 POST 请求已经可以正常工作而无需执行任何特殊操作。
在我的案例中,如何在 Shopware6 上发出POST 请求ALLOW?
谢谢!
最佳答案
您已将路由限制为 POST。当您从另一个方法调用它然后 POST 时,它会导致 Method not allowed 错误。也许您想将 GET 和 POST 都列入白名单?
所以把它改成methods={"GET", "POST"}
关于php - 自定义 Shopware6 路由给出 "405 Method Not Allowed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61908567/
Composer 依赖链是否得到尊重或仍然是安装日期as written here ? 最佳答案 2022 年 7 月更新:它是 now possible for plugins to define
我想在产品列表页面(如产品详情页面)上显示产品评论的总数,如何在列表页面上获取该计数? 最佳答案 这不是那么微不足道。您需要编写一个插件来实现这一点。 在你的插件中你需要create a subscr
我想在产品列表页面(如产品详情页面)上显示产品评论的总数,如何在列表页面上获取该计数? 最佳答案 这不是那么微不足道。您需要编写一个插件来实现这一点。 在你的插件中你需要create a subscr
我在我的模块的详细信息页面上添加了一个自定义选项卡,但是,选项卡已呈现但选项卡的内容未显示。控制台日志中也没有任何错误。 index.js import './page/wt-shopfinder-l
有人知道为什么 Shopware 6 在某些资源的 URL 中使用深层链接代码吗?例如在文档路径 /_action/document/{documentId}/{deepLinkCode} 中。为什么
我正在尝试在 shopware 6 中获取公共(public)文件夹路径,以便使用文件系统在内部创建一个目录。有没有人对此有想法? 最佳答案 你可以看看服务shopware.filesystem.pu
我正在为我的 headless 应用程序使用 Shopware 6 store-api。但我无法弄清楚 Shopware store-api 中有哪些关联例如: 我调用 store-api/accou
我正在努力通过 PHP 导入媒体以使 Shopware 6 正常工作。 这是我的服务: mediaService = $mediaService; } public function
仅供引用:产品是我的 cms 元素名称。 如shopware 6 guides所示,我已经创建了一个文件 DataResolver/ProductsCmsElementResolver.php 它有一
我正在使用 5.2 插件系统开发 Shopware 插件,但无法将 Hook 注册到 sBasket 模块的方法中。 我想要实现的是在从购物篮中删除一篇文章时收到通知,以便能够自动删除其他文章(文章是
在一个插件中,我需要为两个类别停用 Shopware HTTP-Cache。 manual说我应该发出这个事件: Shopware()->Events()->notify( 'Shopware
如果客户使用 REST API (storeurl/store-api/account/register) 注册,我如何防止发送注册电子邮件?我已经尝试将标志“acceptedDataProtecti
当我在我的 Laravel 5.1 上进行 composer update 时出现了这个错误 > Downloading http://packagist.org/p/symfony/polyfill
当我在我的 Laravel 5.1 上进行 composer update 时出现了这个错误 > Downloading http://packagist.org/p/symfony/polyfill
在我运行的一个非常新的设置上 bin/build-storefront.sh 现在 var/plugins.json 在 git 的更改文件列表中。现在我想知道我是否应该提交这个文件,因为它包含本地绝
我为客户创建了一个包含额外设置的自定义表格。接下来,我在客户核心表中添加了一个字段,我想在其中存储每个客户的 ID 选择。我用 EntityExtensionInterface 扩展了 custome
我正在处理用于支付网关的 Shopware6 插件。我必须处理订单交易的状态变化。在我的一个案例中,当我尝试对支付提供商执行退款并且收到错误时,我想阻止订单交易的 Refunded 状态发生变化。 我
我写了一个扩展来将数据添加到 Shopware 6 中的 ProductEntity 并使用了以下教程: https://developer.shopware.com/docs/guides/plug
我在shopware 6中开发了插件,我想将其移动到云端,我们如何才能做到这一点并管理插件的版本? 最佳答案 你不能。在云版本中,您需要 APP . 关于shopware - 我们如何将shopwar
我想实现一个调用外部 API 的功能,然后根据请求是否得到满足将产品行项目添加到购物车,否则它会向客户显示一条已翻译的快速消息,表明该产品无法满足“由于 X 种原因未被添加到购物车。 我尝试过订阅 B
我是一名优秀的程序员,十分优秀!