PHP 中的 show_source() 函数

phpprogrammingserver side programming更新于 2025/9/15 19:07:17

show_source() 函数输出一个高亮 PHP 语法的文件。

语法

show_source(file, return)

参数

  • file − 要显示的文件名。

  • return − 如果此参数设置为 true,此函数将以字符串形式返回高亮的代码,而不是将其打印出来。默认值为 false。

返回

如果 return 参数设置为 true,则 show_source() 函数会将高亮的代码以字符串形式返回,而不是打印出来。否则,如果成功则返回 true,如果失败则返回 false。

示例

以下是示例,我们使用测试文件("new.php")输出高亮 PHP 语法的文件。

<html>
   <body>
      <?php
         show_source("new.php");
      ?>
   </body>
</html>

输出

The output of the browser.

<html>
   <body>
      <?php
         echo ("new.php");
      ?>
   </body>
</html>

相关文章