【发布时间】:2014-08-14 06:07:46
【问题描述】:
在我的 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);
现在打印出来像
那里没有显示上面给定的内容(
a:18:{
i:1;a:8:{
s:4:"type";s:8:"......
)
【问题讨论】:
-
这是一个序列化字符串,使用
unserialize函数将其转换为数组。 -
@Rikesh 我会试试的
-
你试过 ?
-
@Rikesh unserialize 需要字符串参数。但是这里我们有 objecj
-
@Sumurai8 我已删除重复的问题,请立即删除重复