duanji7182 2011-11-30 23:25
浏览 20

PHP搜索CSV脚本

How do I add an if statement to search another csv file? This php file PHP script searches CSV text file here is generating the form base on csv file. I want the user able to chose to search from two separate csv files on the same page

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'];
    }
}
  • 写回答

1条回答 默认 最新

  • doufan8805 2011-11-30 23:31
    关注

    I would take a look at using a loop like foreach() and replace the url you are using with $url from the example below.

    $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>
    ...
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP