PHP 数据表文件导出

PHP datatables file exporting

如何将这两个初始化合并为一个初始化 https://datatables.net/manual/tech-notes/3

<script>
     $(document).ready(function(){
         var dataTable=$('#example').DataTable({
             "processing": true,
             "serverSide":true,
             "ajax":{
                 url:"fetchoffice1.php",
                 type:"post"
             }
         });

     });
 </script>  
 <script type="text/javascript">
   $(document).ready(function() {
      $('#example').DataTable( {
       dom: 'Bfrtip',
      buttons: [
        'copy', 'csv', 'excel', 'pdf', 'print'
            ]
        } );
      } );
 </script>

我不明白这是什么问题。只需组合对象,并对其进行一次初始化:

$(document).ready(function(){
    var dataTable = $('#example').DataTable({
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ],
        processing: true,
        serverSide: true,
        ajax:{
            url: "fetchoffice1.php",
            type: "post"
        }
    });
});