How to display PHP & HTML source code on a page?

后端 未结 8 2077
悲&欢浪女
悲&欢浪女 2020-11-30 14:20

How would one go about showing PHP code on user end. Sort of like w3School does?

Having lets say a grey area div, and then showing the code in there without activati

相关标签:
8条回答
  • 2020-11-30 15:18

    You can use this template........

    ######################################################################
    echo "<h2><br>Source Code of ".basename((string)__FILE__) . "</h2><hr>";
    show_source(__FILE__);
    echo "<hr>";
    echo "<h2>Output of ".basename((string)__FILE__) . "<hr></h2>";
    #######################################################################
    

    It will show the source code and output following.

    0 讨论(0)
  • 2020-11-30 15:20

    use the header function of php, this will rea

    <?php
      header("content-type: text/plain");
    ?>
    
    0 讨论(0)
提交回复
热议问题