如果某值为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,
));
}
?>
1
feiyuanqiu 2015-05-03 05:04:50 +08:00
没太看懂你的代码,不知道你跑没跑过,目测这个代码是不能运行的。
然后,你的描述也没怎么看懂...(如果某值为1,数组的子数组中含有某元素,如果0,那么不含有某元素)这里某值和某元素是什么对应关系?含有某元素的意思是检测通过的时候就往原始数组里面添加某元素吗?检测不通过就去掉原数组中的某元素吗?算了我不猜了 |
2
b821025551b 2015-05-03 11:49:48 +08:00
1、id是“acf下载演示”什么鬼;
2、if里面的数组没赋值,完全没效果,而且你写的也不能运行; 3、实在猜不到要干嘛 |