我很困惑,因为我无法使用以下内容更新“ active_plugins”序列化字段:UPDATE wp_options SET option_value='a:2:{i:0;s:19:"akismet/akismet.php";i:1;s:21:"hello-dolly/hello.php";}' WHERE option_name='active_plugins'
如您所见,我尝试在安装WP时使用原来包含在“ active_plugins”字段中的相同数据来更改该字段...
mysql错误显然是由于字段中的分号(当我取出分号时,-尽管已序列化了数据值,ogf当然...-查询运行成功!
有什么线索吗?
非常感谢
JMB
更新WP数据库序列化选项时出现问题
•
问答
xiazai1999 回答:更新WP数据库序列化选项时出现问题
由于序列化的数组,我可能会在PHP中这样做。您应该执行以下功能:
function update_my_plugins() {
$option = get_option('active_plugins'); // This will return you an array see below
$new_array = [
'something here','another something'
];
update_option('active_plugins',$new_array); // This will automatically reserialize
}
从那里,只需将此函数放在footer.php中,然后访问您的网站。当您访问您的网站时,它将触发,然后您可以将其取出。
,
仍然无法正常工作!
下面显示了当我在PHPMyAdmin中运行查询时出现的错误,并且我不明白为什么(它还会在我的PHP脚本中返回错误。) 。:
UPDATE
wor1865_options
SET
option_value = 'a:2:{i:0;s:19:"akismet/akismet.php";i:1;s:21:"hello-dolly/hello.php";}'
WHERE
option_name = 'active_plugins'