gpt4 book ai didi

javascript - parse_str 函数不适用于查询字符串

转载 作者:行者123 更新时间:2023-12-03 01:54:58 25 4
gpt4 key购买 nike

<script>
var queryString = window.location.search;
queryString = queryString.substring(1);
</script>
<?php
include("assignmentd.php");
$array;
$id=$_COOKIE['id'];
$count = "<script>document.write(queryString)</script>";
$count1=$count;
echo $count;
print_r(parse_str($count1,$array));
print_r($array);
//$q3="INSERT INTO previous_year(clicks)VALUES('$fcount') where id='$id'";
//$m3=mysqli_query($conn,$q3);
?>

I am taking this query String from some other html page but my parse string is not working on $count htmlpage from the quesry string is coming is

<input type="button" value="click me" onClick="count1()"><br>
<input type="button" value="log out" onClick="logout()">
<script>
var count=0;
function count1()
{
alert("in count");
count++;
alert(count);
}
function logout()
{
alert("in logout");
var queryString = "?para1=" + count;
window.location.href = "previous_year_logout.php" + queryString;
}
</script>

最佳答案

只能解析 URL 字符串。解析字符串中不能有脚本标签,也不能像 html 一样在 PHP 上执行 javascript。

使用表单提交数据,然后使用 $_GET 访问它。

关于javascript - parse_str 函数不适用于查询字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50282076/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com