php - 如何根据用户引用加载脚本
问题描述
我想根据用户引用加载一些 javascript 有什么办法吗?
解决方案
您可以执行以下操作,它需要引用者并使用 if 语句加载您需要的内容!
$referrer = $_SERVER['HTTP_REFERER'];
if (preg_match("/site1.com/",$referrer)) {
header('Location: http://www.customercare.com/page-site1.html');
} elseif (preg_match("/site2.com/",$referrer)) {
header('Location: http://www.customercare.com/page-site2.html');
} else {
header('Location: http://www.customercare.com/home-page.html');
};
推荐阅读
- c# - 我收到 500 内部服务器错误,但我不明白为什么
- asp.net-core - 到事件存储问题的 TCP 连接/配置
- python - PyModuleDef_HEAD_INIT 未包含在 Python.h 中?
- java - 在 JLabel 中导航和删除对象列表
- python - datetime 模块不工作,时间不正确
- sql - VBA 访问的更新 SQL 语句中的语法错误(缺少运算符)
- kubernetes - 扩展在 K8s 上运行的 Apache Zookeeper Kubernetes 集群
- r - R 按列分组,计算观察到的组合
- javascript - 为什么10101 | 11100 在 JavaScript 中返回 12157?
- javascript - Vanilla JS 图像幻灯片播放/暂停按钮