Excel到HTML代码不能在mpdf上运行

以下是我的代码:

<?php include('mPDF/mpdf.php'); //$mpdf = new mPDF(); $mpdf=new mPDF('c','A4','9','','10' , '18' , '50' , '50' , '50','13','P' ); $start="<!DOCTYPE html> <html> <head> <title>CSV File to HTML Table Using AJAX jQuery</title> <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script> <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' /> <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'></script> </head> <body> <div class='container'> <div class='table-responsive'> <h1 align='center'>CSV File to HTML Table Using AJAX jQuery</h1> <br /> <div align='center'> <button type='button' name='load_data' id='load_data' class='btn btn-info'>Load Data</button> </div> <br /> <div id='employee_table'> </div> </div> </div> </body> </html> <script> $(document).ready(function(){ $(window).on( 'load', function() { //$('button').load(function(){ $.ajax({ url:'pick.csv', dataType:'text', success:function(data) { var employee_data = data.split(/\r?\n|\r/); var empl_data=employee_data.length-1; //1st part var table_data = '<table border=1 >'; for(var count = 0; count<10; count++) { console.log('employee_data'+empl_data); var cell_data = employee_data[count].split(','); table_data += '<tr>'; for(var cell_count=0; cell_count<cell_data.length; cell_count++) { console.log('cell_data'+cell_data.length); if(count === 0) { table_data += '<th>'+cell_data[cell_count]+'</th>'; } else { table_data += '<td>'+cell_data[cell_count]+'</td>'; } } table_data += '</tr>'; } table_data += '</table>'; //2nd part var table_data1 = '<table border=1 >'; for(var count = 10; count<20; count++) { console.log('employee_data'+empl_data); var cell_data = employee_data[count].split(','); table_data1 += '<tr>'; for(var cell_count=0; cell_count<cell_data.length; cell_count++) { console.log('cell_data'+cell_data.length); if(count === 0) { table_data1 += '<th>'+cell_data[cell_count]+'</th>'; } else { table_data1 += '<td>'+cell_data[cell_count]+'</td>'; } } table_data1 += '</tr>'; } table_data1 += '</table>'; //3nd part var table_data2 = '<table border=1 >'; for(var count = 20; count<empl_data; count++) { console.log('employee_data'+empl_data); var cell_data = employee_data[count].split(','); table_data2 += '<tr>'; for(var cell_count=0; cell_count<cell_data.length; cell_count++) { console.log('cell_data'+cell_data.length); if(count === 0) { table_data2 += '<th>'+cell_data[cell_count]+'</th>'; } else { table_data2 += '<td>'+cell_data[cell_count]+'</td>'; } } table_data2 += '</tr>'; } table_data2 += '</table>'; $('#employee_table').html(table_data+'<br><br><br>'+table_data1+'<br><br><br>'+table_data2); console.log(count); } }); }); }); </script>"; //$mpdf->SetHeader( $header); $mpdf->SetFooter($footer.'{PAGENO}'); $mpdf->WriteHTML($start); //echo $start; $mpdf->Output(); ?> 

此代码不起作用,只有html部分在浏览器上工作,但不能在mpdf上工作。

错误来自正则expression式(data.split(/ \ r?\ n | \ r /);)

我想在pdf上加载一个csv文件。