Display PHP code in browser from the same source script

前端 未结 4 1003
旧巷少年郎
旧巷少年郎 2020-12-20 07:58

Is there a way to display the source code of somepage.php when you go to somepagesrc.php? IOW, is there a PHP function that will in somepage

4条回答
  •  轮回少年
    2020-12-20 08:36

    Take a look at highlight_file(). It not only grabs the php source to display (like file_get_contents()) but nicely formats/colorizes the code for output.

    http://php.net/manual/en/function.highlight-file.php

提交回复
热议问题