PHP OpenCart 语法错误
PHP Syntax Error in OpenCart
我试图在管理面板中访问 opencart 的客户部分并收到此消息
Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ')' in /var/www/vhosts/cloud9herbals.com/cloud9hemp/dev/admin/controller/customer/customer.php on line 1105
这是第 1105 行的代码
} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation'] && $custom_field['location'] == 'address')) && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
如果这还不够,这里是完整的声明
foreach ($custom_fields as $custom_field) {
if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($value['custom_field'][$custom_field['custom_field_id']])) {
$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation'] && $custom_field['location'] == 'address')) && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
}
}
我对 php 知之甚少,但真的很想解决这个问题
这个
empty($custom_field['validation'] && $custom_field['location'] == 'address'))
需要
empty($custom_field['validation']) && $custom_field['location'] == 'address')
我试图在管理面板中访问 opencart 的客户部分并收到此消息
Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ')' in /var/www/vhosts/cloud9herbals.com/cloud9hemp/dev/admin/controller/customer/customer.php on line 1105
这是第 1105 行的代码
} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation'] && $custom_field['location'] == 'address')) && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
如果这还不够,这里是完整的声明
foreach ($custom_fields as $custom_field) {
if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($value['custom_field'][$custom_field['custom_field_id']])) {
$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation'] && $custom_field['location'] == 'address')) && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
}
}
我对 php 知之甚少,但真的很想解决这个问题
这个
empty($custom_field['validation'] && $custom_field['location'] == 'address'))
需要
empty($custom_field['validation']) && $custom_field['location'] == 'address')