我试图传递LibIds的值($ output);输出为" 1000001,1000002"到下面的代码
我想:
function LibIds($output)
{
$rows = get_field('library_add_ids');
if($rows)
{
ob_start();
foreach($rows as $row)
{
echo $row['id'].',';
}
$output = ob_get_clean();
echo rtrim($output, ',');
}
}
$res = $api->query('bibs', array(
'id' => '1000001,1000002',
'fields' => 'id,updatedDate,createdDate,deletedDate,deleted,suppressed,available,lang,title,author,materialType,bibLevel,publishYear,catalogDate,country,orders,normTitle,normAuthor,locations,fixedFields,varFields'
));
......有效......是
function LibIds($output)
{
$rows = get_field('library_add_ids');
if($rows)
{
ob_start();
foreach($rows as $row)
{
echo $row['id'].',';
}
$output = ob_get_clean();
echo rtrim($output, ',');
}
}
$res = $api->query('bibs', array(
'id' => 'LibIds($output);',
'fields' => 'id,updatedDate,createdDate,deletedDate,deleted,suppressed,available,lang,title,author,materialType,bibLevel,publishYear,catalogDate,country,orders,normTitle,normAuthor,locations,fixedFields,varFields'
));
...第3行是问题'id' => '1000001,1000002',
,不确定是否需要解析或最好的方法。 PHP新手。
感谢