简体   繁体   English

在参数列表后)

[英]missing ) after argument list Just when I call one function

I have a weird behavior, when I have call this function $blockProduct in my js part, I will have this error missing ) after argument list but when I change that function with another $blockService , I don't have the error anymore ! 我有一个怪异的行为,当我在js部分中调用此函数$blockProduct时, missing ) after argument list我会遇到此错误( missing ) after argument list但是当我使用另一个$blockService更改该函数时,我不再有错误了!

php: PHP:

$blockService= $blockObject->getPaymentmethodOptionArray();

return: 返回:

array(5) {
  [0] => array(2) {
    ["value"] => string(1) "1"
    ["label"] => string(2) "CB"
  }
  [1] => array(2) {
    ["value"] => string(1) "3"
    ["label"] => string(4) "Visa"
  }
}

$blockProduct = $blockObject->getProductOptionArray();

return: 返回:

array(3) {
  [0] => array(2) {
    ["value"] => string(1) "1"
    ["label"] => string(14) "Bidon d'huile"
  }
}

I think the problem comes from é ? 我认为问题来自é

JS: JS:

jQuery(InputsWrapper3).append(
                    '<div class="added">' +
                        '<select id="produit_option_'+ FieldCount +'"'+ 'class="select" name="produit_option[]">'+
                        '<?php foreach($blockProduct as $prod):?>'+ /*$blockProduit*/
                            '<option value="<?php echo $prod['value']; ?>" selected><?php echo $prod['label']; ?></option>'+
                        '<?php endforeach; ?>'+
                        '</select>' +
                        '<input type="text" name="produit_input[]" id="produit_field_'+ FieldCount3 +'"/>' +
                        ' <a href="#" class="removeclass">'+deleteIcon+'</a>' +
                    '</div>'
                );

使用php转义字符方法,例如,在您的情况下htmlspecialchars($ prod ['value'],ENT_QUOTES,'UTF-8');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM