我使用taxonomy_term_load($ term-> tid)进行分类术语,然后我将文本字段值存储在名为$ session_company的变量中。现在我需要将此字段变量的值与分类术语值之一进行比较。我使用以下代码但结果总是错误的。请告诉我这里做错了什么:
$employee_info_voc = taxonomy_vocabulary_machine_name_load('some_vocab');
$employee_info_tree = taxonomy_get_tree($employee_info_voc->vid);
$employee_list = array();
if(isset($current_user->field_company_session['und'][0]['value'])){
foreach ($employee_info_tree as $term) {
$employee_data = taxonomy_term_load($term->tid);
$employee_company = $employee_data->field_emp_company_name['und'][0]['value'];
$session_company = $current_user->field_company_session['und'][0]['value'];
if($session_company === $employee_company){
$employee_list[] = $term->tid;
}
}