仅使用php代码在Modal Box中加载完整的HTML页面

tej*_*tel 7 php

我有多个HTML文件.我想根据条件在模态框中显示此文件内容.我不想使用iframe和javascript或jquery.所以有可能从php方面只有?

例:

<div class="modal  fade bd-example-modal-lg shopify-onload-popup" id="defaultPopup-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered  modal-lg" role="document">
        <div class="modal-content">
            <?php
            if ($variable == 1) {
                ?>
                <!-- Loade file1.html -->
                <?php
            } else {
                ?>
                <!-- Loade file2.html -->
                <?php
            }
            ?>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

utt*_*ani 7

你可以像这样使用PHP include函数

  <?php
       if ($variable == 1) {
           include "file1.php";
       } else {
           include "file2.php";
       }
   ?>
Run Code Online (Sandbox Code Playgroud)