2

我使用 Web Push PHP 库 https://github.com/Minishlink/web-push-php-example发送推送通知,但我发现了一个问题:

推荐人政策:strict-origin-when-cross-origin

为了您的信息,我使用

  1. PHP --版本
PHP 7.2.34 (cgi-fcgi) (built: Nov  4 2020 16:02:13)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
  1. 此示例的链接:https ://i-confident.com/admin/web-push-php-example/src/index.html

任何人都可以帮助我吗?提前致谢!

在此处输入图像描述

4

2 回答 2

0

利用

header('Access-Control-Allow-Origin: *'); or both
header('Content-type: application/json'); (if want to access your json post data )

**in your send_push_notification.php file at the top**
and also use "www." for your url "https://i-confident.com/.." cause i recently face issue in which i didnt add www. in my url and was not receiving post/get data in my targeted file.
于 2020-11-24T06:44:53.413 回答
0

首先,在我的情况下,您需要安装 php 扩展:

sudo apt install php7.4-gmp

您还需要结帐分支:

git checkout v2.x

然后你应该通过 composer 更新你的依赖:

composer update

然后我检查了它应该可以工作。

在此处输入图像描述

于 2020-11-24T07:32:27.127 回答