gpt4 book ai didi

php - 从 wp_options 表中获取选项值

转载 作者:搜寻专家 更新时间:2023-10-30 23:07:42 25 4
gpt4 key购买 nike

在我的 wp_options 表中,有一个名为 profile_fields 的字段,该字段的值如下所示

a:18:{
i:1;a:8:{
s:4:"type";s:8:"usermeta";s:4:"icon";s:8:"calendar";s:8:"position";s:1:"9";s:5:"field";s:6:"select";s:4:"name";s:15:"Graduation Year";s:4:"meta";s:15:"graduation_year";s:11:"meta_custom";s:0:"";s:6:"social";s:1:"0";s:8:"can_edit";s:1:"1";s:10:"allow_html";s:1:"0";s:8:"can_hide";s:1:"0";s:7:"private";s:1:"0";s:8:"required";s:1:"1";s:17:"show_to_user_role";s:1:"0";s:17:"edit_by_user_role";s:1:"0";
s:16:"show_in_register";
s:1:"1";
s:9:"help_text";
s:0:"";
s:7:"choices";
s:22:"1991
1992
1993
1994";

}
}

为了获得 s22 领域,我必须做些什么。(1991、1992、1993、1994)。我尝试使用 var_dump() 转储值,但它只显示了一些其他字段。

任何人都请帮助我。

更新

我已经像这样从数据库中获取了选项值

$a = get_option( 'upme_profile_fields' );
print_r($a);

现在它打印成

enter image description here

没有显示上面给定的内容(

a:18:{
i:1;a:8:{
s:4:"type";s:8:"......

)

最佳答案

试试这个:-

$a = get_option( 'profile_fields' );
print_r($a);
// find the value you want to un-serialize, then, put as below

$arr = $a["YOUR VALUE KEY"];

$profile_arr = unserialize($arr);

print_r($profile_arr);

关于php - 从 wp_options 表中获取选项值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24378835/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com