【问题标题】:Web Push Php Library Example - Strict Origin When Cross OriginWeb Push Php 库示例 - 跨域时的严格来源
【发布时间】:2021-03-04 06:02:48
【问题描述】:

我使用了 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

有人可以帮助我吗?提前致谢!

【问题讨论】:

  • 您的问题是 apache 或 nginx 问题,而不是 php 问题,请搜索 http 服务器的 cors 设置

标签: php web-push referrer-policy


【解决方案1】:

使用

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.

【讨论】:

  • 兄弟,你能把你的 api 命中响应显示的网络视图快照发给我吗?
【解决方案2】:

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

sudo apt install php7.4-gmp

你还需要结帐分支:

git checkout v2.x

那么你应该通过 composer 更新你的依赖:

composer update

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-04-27
  • 1970-01-01
  • 1970-01-01
  • 2022-06-13
  • 2021-06-30
  • 2019-02-25
  • 1970-01-01
相关资源
最近更新 更多