如果某值为1,数组的子数组中含有某元素,如果0,那么不含有某元素,大家能否提供一下方法?下面的是我自己写的,由于PHP不是很擅长,求指教
<?php
if (ofget_option('themetuts_download_open')==1) {
register_field_group(array (
'id' => 'acf%e4%b8%8b%e8%bd%bd%e6%bc%94%e7%a4%ba',
'title' => '下载演示',
'fields' => array (
array (
'key' => 'field_553a4b55979cd',
'label' => '开启演示以及下载',
'name' => 'post_down_open',
'type' => 'radio',
'instructions' => '请选择本篇文章是否需要开启演示以及下载功能',
'choices' => array (
1 => '是',
0 => '否',
),
'other_choice' => 0,
'save_other_choice' => 0,
'default_value' => 0,
'layout' => 'horizontal',
),
if (of_get_option('themetuts_download_file')==1) {
array (
'key' => 'field_553a4f38ec358',
'label' => '显示资源大小',
'name' => 'post_down_yuan_radio',
'type' => 'radio',
'choices' => array (
1 => '是',
0 => '否',
),
'other_choice' => 0,
'save_other_choice' => 0,
'default_value' => 0,
'layout' => 'horizontal',
),
array (
'key' => 'field_553a4f86ec359',
'label' => '资源大小',
'name' => 'post_down_yuan',
'type' => 'text',
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_553a4f38ec358',
'operator' => '==',
'value' => '1',
),
),
'allorany' => 'all',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'html',
'maxlength' => '',
),
}
if (of_get_option('themetuts_download_update_time')==1) {
array (
'key' => 'field_553a4f9bec35a',
'label' => '显示更新时间',
'name' => 'post_down_update_radio',
'type' => 'radio',
'choices' => array (
1 => '是',
0 => '否',
),
'other_choice' => 0,
'save_other_choice' => 0,
'default_value' => 0,
'layout' => 'horizontal',
),
array (
'key' => 'field_553a4fc8ec35b',
'label' => '资源更新时间',
'name' => 'post_down_update',
'type' => 'date_picker',
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_553a4f9bec35a',
'operator' => '==',
'value' => '1',
),
),
'allorany' => 'all',
),
'date_format' => 'yymmdd',
'display_format' => 'dd/mm/yy',
'first_day' => 1,
),
}
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
'order_no' => 0,
'group_no' => 0,
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
'order_no' => 0,
'group_no' => 1,
),
),
),
'options' => array (
'position' => 'normal',
'layout' => 'default',
'hide_on_screen' => array (
),
),
'menu_order' => 40,
));
}
?>
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.