dongnao6858 2017-12-19 05:12
浏览 33

在excel文件列php中重写内容

I need to read an excel file in my codeigniter project. This is my example file.

enter image description here

I need to rewrite dynamic content(eg %VAR1 and %VAR2 ) inmsg field with the content in corresponding column.
ie The msg content in first row will be Dear (John) this I sa demo message. 8952 test.
The number of dynamic content may vary from 0 to n.(%VAR1, %VAR2, %VAR3 etc).
Please help me to do this
This is my code:

$filename=$_FILES["contactFile"]["tmp_name"];
if (($handle = fopen($filename, "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>
";
        $row++;
        for ($c=0; $c < $num; $c++) { 
            echo $data[$c] . "<br />
";

        }
    }
    fclose($handle);
}

it displays content in each column. But how do i replace with another column value

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本