1

基本上,我需要在包含之后查看文件的 PHP 代码。我试图确切地查看正在运行的 PHP 代码。例如...

<?php // a.php
    $a = 10;
?>

<?php // b.php
    include('a.php');
    $b = 20;
?>

如果我试图获取 b.php 的代码,它将显示以下内容:

<?php
    $a = 10;
    $b = 20;
?>

那可能吗?如果是这样,怎么做?

4

1 回答 1

3
// at the end of your script
<?php
$totalRunCode = '';
$scripts = get_included_files();
foreach($scripts as $script)
{
   $totalRunCode .= file_get_contents($script);
}

// do whatever with totalRunCode

虽然我不知道你为什么要这样做。

于 2012-08-02T02:20:06.333 回答