我希望有一个人在这个问题上帮助我,我有代码
$("#test").jCombo("{!! url('test/comboselect?filter=pos:po_code:po_code&limit=WHERE:done_by:!=:1') !!}",
与此功能相关,
function getComboselect( Request $request)
{
if($request->ajax() == true && \Auth::check() == true)
{
$param = explode(':',$request->input('filter'));
$parent = (!is_null($request->input('parent')) ? $request->input('parent') : null);
$limit = (!is_null($request->input('limit')) ? $request->input('limit') : null);
$rows = $this->model->getComboselect($param,$limit,$parent);
$items = array();
$fields = explode("|",$param[2]);
foreach($rows as $row)
{
$value = "";
foreach($fields as $item=>$val)
{
if($val != "") $value .= $row->{$val}." ";
}
$items[] = array($row->{$param['1']} , $value);
}
return json_encode($items);
} else {
return json_encode(array('OMG'=>" Ops .. Cant access the page !"));
}
}
我需要为变量限制发送许多值,并在此函数中接收;
$("#test").jCombo("{!! url('test/comboselect?filter=pos:po_code:po_code&limit=WHERE:done_by:!=:1&limit=WHERE:entry_by:=:1') !!}",
答案 0 :(得分:1)
URL参数可以表示数组,因此不是
limit=WHERE:done_by:!=:1&limit=WHERE:entry_by:=:1
你可以做到
limit[]=WHERE:done_by:!=:1&limit[]=WHERE:entry_by:=:1
[]
导致PHP将它们解析为一个字符串数组。所以在你的PHP代码中你可以
$limit = null;
if (!empty($request->input('limit'))) {
$limit = $request->input('limit');
if (is_array($limit) {
// $limit[0] = WHERE:done_by:!=:1
// $limit[1] = WHERE:entry_by:=:1
//
}
}