如何使用 Laravel 在字符串中发送参数
How to send the parameter in a string using Laravel
当我使用 Form::select 时,我可以在内部传递一个属性参数,它是一个数组,但是我在将 Id 与字符串的其余部分连接起来时遇到问题
{!! Form::select('product_category_id', $categories, null, ['class' => '','onchange' => 'addComboCategory(this, null,\'ajax_product_category\', \'ajax_product_info\', \'?parameter_id=2\')']) !!}
方法:
'onchange' => 'addComboCategory(this, null,\'ajax_product_category\', \'ajax_product_info\', \'?parameter_id=2\')
参数:
\'?parameter_id=2\'
这个怎么样?
'onchange' => "addComboCategory(this, null, 'ajax_product_category', 'ajax_product_info', '?parameter_id=2')"
有变量:
$id = 2;
'onchange' => "addComboCategory(this, null, 'ajax_product_category', 'ajax_product_info', '?parameter_id={$id}')"
当我使用 Form::select 时,我可以在内部传递一个属性参数,它是一个数组,但是我在将 Id 与字符串的其余部分连接起来时遇到问题
{!! Form::select('product_category_id', $categories, null, ['class' => '','onchange' => 'addComboCategory(this, null,\'ajax_product_category\', \'ajax_product_info\', \'?parameter_id=2\')']) !!}
方法:
'onchange' => 'addComboCategory(this, null,\'ajax_product_category\', \'ajax_product_info\', \'?parameter_id=2\')
参数:
\'?parameter_id=2\'
这个怎么样?
'onchange' => "addComboCategory(this, null, 'ajax_product_category', 'ajax_product_info', '?parameter_id=2')"
有变量:
$id = 2;
'onchange' => "addComboCategory(this, null, 'ajax_product_category', 'ajax_product_info', '?parameter_id={$id}')"