如標題中所述,我的代碼在本地工作,但不在服務器上。更準確地說,當我調用任何 PHP 函數時,它找不到我的 JS 函數。總結一下:這里的目標是從通過從數據庫中檢索數據創建的 HTML 表中生成一個 excel (.XLS) 文件。我的 Wamp 服務器在本地一切正常,但是當我將它移動到服務器時,調用 JS 函數 getDashboardResumeJ () 時出現此錯誤:DashboardResume.php:124 Uncaught ReferenceError: getDashboardResumeJ is not defined如果我刪除主文件中的所有 PHP,則在服務器上一切正常。主文件中的 PHP:<button id="buttonXLS" href="#" onclick="exportTableToExcel('tableRecap', 'Rapport Mensuel <?php echo $year . '/' . $month?>')">Export to Excel</button> <table style="display:none" id="tableRecap" > <tr> <td style="font-weight: bold">Nom et prénom</td> <?php $arrayId = array(selectTableEmploye('nom', 'prenom')); ?> </tr> <tr> <td style="font-weight: bold">Date d'entrée</td> <?php selectTableEmploye('date_embauche'); ?> </tr> <tr> <td style="font-weight: bold">Date de sortie</td> <?php selectTableEmploye('date_depart'); ?> </tr> <tr> <td style="font-weight: bold">Remarque 1</td> <?php selectTableTimesheet('commentaire1',$arrayId,$month,$year); ?> </tr> <tr> <td style="font-weight: bold">Remarque 2</td> <?php selectTableTimesheet('commentaire2',$arrayId,$month,$year); ?> </tr> <tr> <td style="font-weight: bold">Remarque 3</td> <?php selectTableTimesheet('commentaire3',$arrayId,$month,$year); ?> </tr> <tr> <td style="font-weight: bold">Remarque 4</td> <?php selectTableTimesheet('commentaire4',$arrayId,$month,$year); ?> </tr> <?php generateDays($dateMonth, $dateYear); ?> </table>
在服務器上調用 PHP 函數但在本地服務器上工作時找不到 JS 函數
慕沐林林
2022-07-21 21:10:06