我很困惑,因为我无法使用以下内容更新“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当然...... - 查询成功运行!任何线索?
2 回答
慕码人2483693
TA贡献1860条经验 获得超9个赞
由于序列化数组,我可能会在 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 并访问您的站点。当您访问您的网站时它会触发,然后您可以将其取出。
Smart猫小萌
TA贡献1911条经验 获得超7个赞
还是不行!!!
当我在 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'

- 2 回答
- 0 关注
- 183 浏览
添加回答
举报
0/150
提交
取消
