【发布时间】:2020-01-28 23:15:50
【问题描述】:
我该如何解决这个问题?
//error_reporting(0);
$token = $_POST['token'];
$invite = $_POST['invite'];
$url = "https://mywebsite.com/asd/".$invite."";
$dingaling = "$token"
?>
时间:https://mywebsite.com/asdsdsss.php?token=test&invite=test2
错误:
注意:未定义索引:第 3 行 D:\asdsdsss.php 中的标记
注意:未定义索引:在 D:\asdsdsss.php 第 4 行邀请
【问题讨论】:
-
$_POST不是一种方法。它是一个关联数组,包含从客户端请求的帖子正文到您的端点的查询字符串值。您提供的 url 在 url 中有查询字符串,它将被解析为$_GET关联数组,而不是$_POST。 php.net/manual/en/reserved.variables.post.phpphp.net/manual/en/reserved.variables.get.php -
@Taplar 现在当我通过 javascript 发布帖子时它不起作用。
-
你提交表单了吗?
-
@VinayKaklotar 在这里:让 xhttp = new XMLHttpRequest(); xhttp.open("POST", "asdsdsss.php", true); xhttp.setRequestHeader("内容类型", "application/x-www-form-urlencoded"); xhttp.send("token=" + thetokenbruh + "&invite=" + theinvitebruh);
-
@dawaeboi 你应该试试
ajax!
标签: javascript php arrays post http-post