POST数组保留其值 [英] POSTed arrays keep their values

查看:73
本文介绍了POST数组保留其值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我注意到我的一个Wordpress安装的行为很奇怪:每当我从仪表板更新帖子时,它的一些额外输入都会保留它们已经具有的值(它们都是多维数组)。例如:

Today I noticed one of my Wordpress installations is behaving in a very strange way: whenever I update a post from the Dashboard, some of its extra inputs keep the values they already have (all of them are multi-dimensional arrays). For example:

[post.php?post = 123& action = edit]

<input type="text" id="field_a0b" class="text" name="fields[a][0][b]" 
value="Current value" placeholder="">

如果我手动编辑该帖子(如最终用户那样),则更改当前值新值,然后点击更新按钮, $ _ POST ['fields '] ['a'] [0] ['b'] 仍将包含当前值-不是新值就像我期望的那样。

If I edit that post manually (as an end user would), changing Current value to New value, then hit the Update button, $_POST['fields']['a'][0]['b'] will still contain Current value - not New value as I would expect.

这仅在那些输入数组中发生。另外,如果我将 name = fields [a] [0] [b] 更改为随机值,例如 name = fields [a] [0] [bbbbbbbb] ,然后打印该内容,然后得到在输入字段中输入的值!

This only happens with those input arrays. Also, if I change name="fields[a][0][b]" to something random, like name="fields[a][0][bbbbbbbb]", and then print that thing, then I get the value I entered in the input field!

我ve入侵了Wordpress文件以从多个位置(甚至从 load.php )转储数据,但仍然没有成功。

I've hacked Wordpress files to dump data from multiple places (even from load.php), still without success.

不确定这是否重要,但是生成这些HTML输入的插件称为ACF(高级自定义字段)。

Not sure if this is important, but the plugin generating those HTML inputs is called ACF (Advanced Custom Fields).

推荐答案

我以前发现过,如果我正在重用一个数组,每次使用完该数组都应取消设置该数组。这样,您无疑会清除该数组以供重用。

I have found in the past, if I'm reusing an array, that I should unset that array each time when I'm done with it. That way you undoubtedly clear that array for reuse.

这篇关于POST数组保留其值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆