csv抽出列问题-续


<form class="mt20" method="post" action="">
                        <input id="data_html" type="hidden" name="data">
                        <input type="hidden" name="action" value="csv_out">
                        <input class="btn btn-primary" type="submit" value="CSVで保存">
                    </form>
                    <div id="div_html">
                        <table class="table">
                            <thead>
                                <tr>
                                    <th><?php echo $word->get('lesson_id'); ?></th>
                                    <th><?php echo $word->get('client_name'); ?></th>
                                    <th><?php echo $word->get('app_id'); ?></th>
                                    <th><?php echo $word->get('app_name'); ?></th>
                                    <th><?php echo $word->get('ymd'); ?></th>
                                    <th><?php echo $word->get('time'); ?></th>
                                    <th><?php echo $word->get('lesson_form'); ?></th>
                                    <th><?php echo $word->get('lesson_type'); ?></th>
                                    <th><?php echo $word->get('classroom'); ?></th>
                                    <th><?php echo $word->get('tutor'); ?></th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($list as $info) : ?>
                                    <tr>
                                        <td>
                                            <a href="<?php echo get_url_top(); ?>/assign/conf?id=<?php echo $info->id; ?>&back_to=assign_index"><?php echo $info->id; ?></a>
                                            <?php if ($info->lesson_reserve_request_id) : ?>
                                                <br>[仮]No.<?php echo $info->lesson_reserve_request_id; ?>
                                            <?php endif; ?>
                                        </td>
                                        <td><a href="<?php echo get_url_top(); ?>/client/conf?id=<?php echo $info->client_id; ?>"><?php echo $info->client_name; ?></a></td>
                                        <td><a href="<?php echo get_url_top(); ?>/app/conf?id=<?php echo $info->app_id; ?>" target="_blank"><?php echo $info->app_id; ?></a></td>
                                        <td><a href="<?php echo get_url_top(); ?>/app/conf?id=<?php echo $info->app_id; ?>" target="_blank"><?php echo $info->lesson_name; ?></a></td>
                                        <td><?php echo $info->date; ?></td>
                                        <td><?php echo $info->start_time; ?><?php echo $info->end_time; ?></td>
                                        <td><?php echo MasterCode::get_one_by_type_code(CODE_TYPE_LESSON_FORM, $info->form)->name; ?></td>
                                        <td><?php echo $info->lesson_type_str; ?></td>
                                        <?php if ($info->form == 1) : ?>
                                            <?php if ($info->classroom_assigned == 1) : ?>
                                                <td>
                                                    <?php echo $info->classroom_name; ?>
                                                </td>
                                            <?php else : ?>
                                                <td>
                                                    <span class="label label-danger"><?php echo $word->get('unset'); ?></span>
                                                </td>
                                            <?php endif; ?>
                                        <?php else : ?>
                                            <td>----</td>
                                        <?php endif; ?>
                                        <?php if ($info->tutor_assigned == 1) : ?>
                                            <td>
                                                <a href="<?php echo get_url_top(); ?>/tutor_admin/conf?id=<?php echo $info->tutor_id; ?>" target="_blank"><?php echo $info->tutor_dispname; ?></a>
                                            </td>
                                        <?php else : ?>
                                            <td>
                                                <span class="label label-danger"><?php echo $word->get('unset'); ?></span>
                                            </td>
                                        <?php endif; ?>
                                        <td>
                                            <?php if ($info->lesson_state & LSN_REPLACED) : ?>
                                                <span class="label label-danger">Replaced</span>
                                            <?php elseif ($info->lesson_state & LSN_TTR_CANCELLED) : ?>
                                                <span class="label label-danger">Cancelled</span>
                                            <?php elseif ($info->lesson_state & LSN_ADM_CANCELLED) : ?>
                                                <span class="label label-danger">Cancelled by admin</span>
                                            <?php elseif ($info->lesson_state & LSN_CLI_CANCELLED) : ?>
                                                <span class="label label-danger">Cancelled by client</span>
                                            <?php elseif ($info->lesson_state & LSN_TTR_CANCEL_REQUEST) : ?>
                                                <span class="label label-danger">Cancel requested</span>
                                            <?php elseif ($info->lesson_state & LSN_TTR_READY) : ?>
                                                <span class="label label-success">Ready</span>
                                            <?php else : ?>
                                                <span class="label label-warning">Not Ready</span>
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <?php if ($bigin_last_list) : ?>
                                                <?php foreach ($bigin_last_list as $begin_last_info) : ?>
                                                    <?php if ($info->app_id === $begin_last_info->app_id) : ?>

                                                        <!-- first lesson label -->
                                                        <?php if (($info->date === $begin_last_info->begin_date) && ($info->start_time === $begin_last_info->begin_time)) : ?>
                                                            <span class="label label-info">First Lesson</span>
                                                            <?php break; ?>
                                                        <?php endif; ?>
                                                        <?php if (($info->lesson_estimated_time <= $begin_last_info->total_actual_hours) && ($info->date === $begin_last_info->now_last_date) && ($info->end_time === $begin_last_info->now_last_time)) : ?>
                                                            <span class="label label-info">Last Lesson</span>
                                                            <?php break; ?>
                                                        <?php endif; ?>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            <?php endif; ?>
                                        </td>
                                        <td style="display: none"><?php echo $info->tutor_name; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_code; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_zipcode; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_address; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_delivery_email; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_tel; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_tel_mobile; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_available_str; ?></td>
                                        <td>
                                            <a class="btn btn-primary" href="<?php echo get_url_top(); ?>/assign/conf?id=<?php echo $info->id; ?>&back_to=assign_index"><?php echo $word->get('select'); ?></a>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    

删除最后一列可以用下面的代码


<form class="mt20" method="post" action="">
    <input id="data_html" type="hidden" name="data">
    <input type="hidden" name="action" value="csv_out">
    <input class="btn btn-primary" type="submit" value="CSVで保存">
</form>
<div id="div_html">
    <table class="table">
        <thead>
            <tr>
                <th><?php echo $word->get('lesson_id'); ?></th>
                <th><?php echo $word->get('client_name'); ?></th>
                <th><?php echo $word->get('app_id'); ?></th>
                <th><?php echo $word->get('app_name'); ?></th>
                <th><?php echo $word->get('ymd'); ?></th>
                <th><?php echo $word->get('time'); ?></th>
                <th><?php echo $word->get('lesson_form'); ?></th>
                <th><?php echo $word->get('lesson_type'); ?></th>
                <th><?php echo $word->get('classroom'); ?></th>
                <th><?php echo $word->get('tutor'); ?></th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($list as $info) : ?>
            <tr>
                <td>
                    <a href="<?php echo get_url_top(); ?>/assign/conf?id=<?php echo $info->id; ?>&back_to=assign_index"><?php echo $info->id; ?></a>
                    <?php if ($info->lesson_reserve_request_id) : ?>
                    <br>[仮]No.<?php echo $info->lesson_reserve_request_id; ?>
                    <?php endif; ?>
                </td>
                <td><a href="<?php echo get_url_top(); ?>/client/conf?id=<?php echo $info->client_id; ?>"><?php echo $info->client_name; ?></a></td>
                <td><a href="<?php echo get_url_top(); ?>/app/conf?id=<?php echo $info->app_id; ?>" target="_blank"><?php echo $info->app_id; ?></a></td>
                <td><a href="<?php echo get_url_top(); ?>/app/conf?id=<?php echo $info->app_id; ?>" target="_blank"><?php echo $info->lesson_name; ?></a></td>
                <td><?php echo $info->date; ?></td>
                <td><?php echo $info->start_time; ?><?php echo $info->end_time; ?></td>
                <td><?php echo MasterCode::get_one_by_type_code(CODE_TYPE_LESSON_FORM, $info->form)->name; ?></td>
                <td><?php echo $info->lesson_type_str; ?></td>
                <?php if ($info->form == 1) : ?>
                <?php if ($info->classroom_assigned == 1) : ?>
                <td>
                    <?php echo $info->classroom_name; ?>
                </td>
                <?php else : ?>
                <td>
                    <span class="label label-danger"><?php echo $word->get('unset'); ?></span>
                </td>
                <?php endif; ?>
                <?php else : ?>
                <td>----</td>
                <?php endif; ?>
                <?php if ($info->tutor_assigned == 1) : ?>
                <td>
                    <a href="<?php echo get_url_top(); ?>/tutor_admin/conf?id=<?php echo $info->tutor_id; ?>" target="_blank"><?php echo $info->tutor_dispname; ?></a>
                </td>
                <?php else : ?>
                <td>
                    <span class="label label-danger"><?php echo $word->get('unset'); ?></span>
                </td>
                <?php endif; ?>
                <td>
                    <?php if ($info->lesson_state & LSN_REPLACED) : ?>
                    <span class="label label-danger">Replaced</span>
                    <?php elseif ($info->lesson_state & LSN_TTR_CANCELLED) : ?>
                    <span class="label label-danger">Cancelled</span>
                    <?php elseif ($info->lesson_state & LSN_ADM_CANCELLED) : ?>
                    <span class="label label-danger">Cancelled by admin</span>
                    <?php elseif ($info->lesson_state & LSN_CLI_CANCELLED) : ?>
                    <span class="label label-danger">Cancelled by client</span>
                    <?php elseif ($info->lesson_state & LSN_TTR_CANCEL_REQUEST) : ?>
                    <span class="label label-danger">Cancel requested</span>
                    <?php elseif ($info->lesson_state & LSN_TTR_READY) : ?>
                    <span class="label label-success">Ready</span>
                    <?php else : ?>
                    <span class="label label-warning">Not Ready</span>
                    <?php endif; ?>
                </td>
                <td>
                    <?php if ($bigin_last_list) : ?>
                    <?php foreach ($bigin_last_list as $begin_last_info) : ?>
                    <?php if ($info->app_id === $begin_last_info->app_id) : ?>

                    <!-- first lesson label -->
                    <?php if (($info->date === $begin_last_info->begin_date) && ($info->start_time === $begin_last_info->begin_time)) : ?>
                    <span class="label label-info">First Lesson</span>
                    <?php break; ?>
                    <?php endif; ?>
                    <?php if (($info->lesson_estimated_time <= $begin_last_info->total_actual_hours) && ($info->date === $begin_last_info->now_last_date) && ($info->end_time === $begin_last_info->now_last_time)) : ?>
                    <span class="label label-info">Last Lesson</span>
                    <?php break; ?>
                    <?php endif; ?>
                    <?php endif; ?>
                    <?php endforeach; ?>
                    <?php endif; ?>
                </td>
                <td style="display: none"><?php echo $info->tutor_name; ?></td>
                <td style="display: none"><?php echo $info->tutor_code; ?></td>
                <td style="display: none"><?php echo $info->tutor_zipcode; ?></td>
                <td style="display: none"><?php echo $info->tutor_address; ?></td>
                <td style="display: none"><?php echo $info->tutor_delivery_email; ?></td>
                <td style="display: none"><?php echo $info->tutor_tel; ?></td>
                <td style="display: none"><?php echo $info->tutor_tel_mobile; ?></td>
                <td style="display: none"><?php echo $info->tutor_available_str; ?></td>
                <td>
                    <a class="btn btn-primary" href="<?php echo get_url_top(); ?>/assign/conf?id=<?php echo $info->id; ?>&back_to=assign_index"><?php echo $word->get('select'); ?></a>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>

    <script src="https://g.csdnimg.cn/??lib/jquery/1.12.4/jquery.min.js"></script>
    <script>
    var table = $('#div_html>table').clone();

        table.find(`tr th:last-child,tr td:last-child`).remove()


    var html = table[0].outerHTML
    $('#data_html').html(html)
    console.log(html)
    </script>




您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632