有人能解释如何解释和理解active_plugins option_value字符串在WordPress中的含义吗?然后使用这个字符串/数组来禁用和激活特定的插件?
下面是一个示例:
a:8:{i:0;s:21:"adrotate/adrotate.php";i:1;s:19:"akismet/akismet.php";i:2;s:33:"better-related/better-related.php";i:3;s:17:"clicky/clicky.php";i:4;s:49:"custom-post-permalinks/custom-post-permalinks.php";i:5;s:32:"disqus-comment-system/disqus.php";i:6;s:33:"export-to-text/export-to-text.php";i:7;s:36:"google-sitemap-generator/sitemap.php";}发布于 2012-03-10 11:24:13
这是一个序列化数组。
// Serialized:
a:8:{i:0;s:21:"adrotate/adrotate.php";i:1;s:19:"akismet/akismet.php";i:2;s:33:"better-related/better-related.php";i:3;s:17:"clicky/clicky.php";i:4;s:49:"custom-post-permalinks/custom-post-permalinks.php";i:5;s:32:"disqus-comment-system/disqus.php";i:6;s:33:"export-to-text/export-to-text.php";i:7;s:36:"google-sitemap-generator/sitemap.php";}
// dump:
var_dump( maybe_unserialize('a:8:{i:0;s:21:"adrotate/adrotate.php";i:1;s:19:"akismet/akismet.php";i:2;s:33:"better-related/better-related.php";i:3;s:17:"clicky/clicky.php";i:4;s:49:"custom-post-permalinks/custom-post-permalinks.php";i:5;s:32:"disqus-comment-system/disqus.php";i:6;s:33:"export-to-text/export-to-text.php";i:7;s:36:"google-sitemap-generator/sitemap.php";}') );
// Result
array(8) {
[0]=>
string(21) "adrotate/adrotate.php"
[1]=>
string(19) "akismet/akismet.php"
[2]=>
string(33) "better-related/better-related.php"
[3]=>
string(17) "clicky/clicky.php"
[4]=>
string(49) "custom-post-permalinks/custom-post-permalinks.php"
[5]=>
string(32) "disqus-comment-system/disqus.php"
[6]=>
string(33) "export-to-text/export-to-text.php"
[7]=>
string(36) "google-sitemap-generator/sitemap.php"
}使用maybe_unserialize()或unserialize()将其转换回数组。
发布于 2017-01-11 07:14:32
与JSON相比,它的任务非常重!虽然也不太难。
这是我的改版前的。我想禁用谷歌认证,让我自己再次登录。我的提供者现在免费提供HTTPS,谢天谢地,不过在此之前,我依赖于身份验证器来防范密码嗅探。不管有没有HTTPS,它仍然是一个非常有用的特性。因此,一旦我的手机有了新的令牌,我打算重置并重新启用它。

它看起来像“数组,长度5”,对于每一项“索引,长度,值”。我已经突出显示了身份验证器的条目。我的修改是删除这个条目,将数组长度修改为4,并减少所有后续条目的索引值。
这是显示零钱的差别。为了便于阅读,我把它格式化了。如果像这样格式化的话,我不希望它起作用!

发布于 2020-04-18 01:50:28
我有超过几次,我不能禁用插件在我们的Wordpress网站,唯一的途径是数据库访问。我可以读/写数据库,所以我制作了这个python工具,以人类可读的形式列出插件;按行号从列表中删除它们;将删除插件保存到备份文件中;并创建一个新的PHP字符串以插入数据库。
当我从这个线程中获得灵感时,我想我应该在这里添加一个链接:https://github.com/Solarbotics/Wordpress_插件_管理_通过_数据库
https://wordpress.stackexchange.com/questions/45109
复制相似问题