我想通过帖子为基本的管理面板为一个网站的3个变量。通过帖子传递json对象以及其他数据
我有像这样
<script>
var json = {"thing":"stuff"};
var json_file = JSON.stringify(json);
</script>
<form action='load.php' method='post'>
<input type='hidden' name='username' value='<?php echo $_POST["username"]; ?>' />
<input type='hidden' name='password' value='<?php echo $_POST["password"]; ?>' />
<input type='hidden' name='json' value='json_file' />
<input type='submit' value='Submit' />
</form>
我需要传递下去,以确保人是为了有机会获得用户名和密码的形式。而json是为了传递,所以PHP脚本可以将它写入文件。
我试图在包装btoa(json_file)
json_file
,并使用base64_decode($_POST["json"])
写的,但它总是写的东西不应该“”
为什么不把这样的事情在一个会话?没有必要把他们放在一个网页表格中,他们可以被损坏或篡改 – Machavity
你在这里缺少一个引用:'{“thing”:“stuff”}'。 – ryanpcmcquen
为什么不通过AJAX尝试它并附加用户和密码?一个URL编码? – MikeVelazco