如何添加if语句来搜索其他csv文件?这个php文件PHP script searches CSV text file在这里生成基于csv文件的表单。我希望用户能够选择从同一页面上的两个单独的csv文件进行搜索
include('csvtoservice.php');
$content = csvtoservice(
'http://www.scgstudio.com/ucsc/web/Workbook3.csv',
array(
'filter' => array(fieldnames),
'rename' => array(
'name' => 'Name',
'donortype' => 'Donor Type',
'year' => 'Year',
'amount' => 'Amount'
),
'uppercase' => Boolean
)
);
if ($content) {
// show the form
echo '<h2>Honor Roll of 2010-11 Contributors</h2>';
if ($content['form']) {
echo $content['form'];
}
}
答案 0 :(得分:0)
我会看一下使用像foreach()
这样的循环,并用下面示例中的$url
替换您正在使用的网址。
$urls = array('http://www.scgstudio.com/ucsc/web/Workbook3.csv',
'http://www.scgstudio.com/ucsc/web2/Workbook3.csv',
'http://www.scgstudio.com/ucsc/web3/Workbook3.csv');
include('csvtoservice.php');
foreach($urls as $url) {
...
<your code here>
...
}