在服务器上调用 PHP 函数但在本地服务器上工作时找不到 JS 函数

如标题中所述,我的代码在本地工作,但不在服务器上。更准确地说,当我调用任何 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>


慕沐林林
浏览 98回答 1
1回答

Cats萌萌

对于那些有同样问题的人来说,我正在使用的服务器与我在本地工作的服务器没有相同的 PHP 版本。在本地和服务器上尝试 phpinfo() 以检查您的 PHP 版本是否相同。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript