.shtml和.php页面包括虚拟和运行的php问题

.shtml和.php页面包括虚拟和运行的php问题,php,include,Php,Include,我有一个奇怪的问题。它可能与服务器有关,但我不知道要查找什么 我有一个.php页面,其中包含一些虚拟内容: <?php virtual ("nav.shtml"); ?> …贯穿始终。我还有一个以表格形式显示XML数据的解析器 解析器使用标准: <?php include ('parser.php'); ?> …但是,如果我在include上有虚拟值,那么解析器就不能工作。或者至少它找不到文件,但是,文件在那里,它在虚拟机上工作,显示得很好 例如,这项工作: <

我有一个奇怪的问题。它可能与服务器有关,但我不知道要查找什么

我有一个.php页面,其中包含一些虚拟内容:

<?php virtual ("nav.shtml"); ?>
…贯穿始终。我还有一个以表格形式显示XML数据的解析器

解析器使用标准:

 <?php include ('parser.php'); ?>
…但是,如果我在include上有虚拟值,那么解析器就不能工作。或者至少它找不到文件,但是,文件在那里,它在虚拟机上工作,显示得很好

例如,这项工作:

<?php include ('parser.php'); ?>
<?php virtual ('file.shtml'); ?>
这并不是:

<?php virtual ('file.shtml'); ?>
<?php include ('parser.php'); ?>
我是不是遗漏了什么

以下是index.shtml页面代码:

<?php virtual ("nav.shtml"); ?>
     <div id="sortabletable">
                      <table id="myTable" class="tablesorter">
                        <thead>
                          <tr>
                            <th>Subject</th>
                            <th>Committee</th>
                            <th>Witness</th>
                            <th>Date</th>
                            <th>Bill</th>
                            <th>Link</th>
                          </tr>
                        </thead>
                        <tbody>
                            <?php include('parser.php'); ?>
                        </tbody>
                      </table>
                    </div>
     <?php virtual ("footer.shtml"); ?>
以下是解析器代码:

<?php 
$xml_file = "test.xml"; 

$xml_subject_key = "*TESTIMONIES*CONGRESS*SUBJECT"; 
$xml_committee_key = "*TESTIMONIES*CONGRESS*COMMITTEE"; 
$xml_witness_key = "*TESTIMONIES*CONGRESS*WITNESS"; 
$xml_date_key = "*TESTIMONIES*CONGRESS*DATE"; 
$xml_bill_key = "*TESTIMONIES*CONGRESS*BILL"; 
$xml_link_key = "*TESTIMONIES*CONGRESS*LINK"; 

$congress_array = array(); 

$counter = 0; 
class xml_story{ 
    var  $subject, $committee, $witness, $date, $bill, $link; 
} 

function startTag($parser, $data){ 
    global $current_tag; 
    $current_tag .= "*$data"; 
} 

function endTag($parser, $data){ 
    global $current_tag; 
    $tag_key = strrpos($current_tag, '*'); 
    $current_tag = substr($current_tag, 0, $tag_key); 
} 

function contents($parser, $data){ 
    global $current_tag, $xml_subject_key, $xml_committee_key, $xml_witness_key, $xml_date_key, $xml_bill_key, $xml_link_key, $counter, $congress_array; 
    switch($current_tag){ 
        case $xml_subject_key: 
            $congress_array[$counter]->subject = $data; 
            break; 
        case $xml_committee_key: 
            $congress_array[$counter]->committee = $data; 
            break; 
        case $xml_witness_key: 
            $congress_array[$counter]->witness = $data; 
            break; 
        case $xml_date_key: 
            $congress_array[$counter]->date = $data; 
            break; 
        case $xml_bill_key: 
            $congress_array[$counter]->bill = $data; 
            break; 
        case $xml_link_key: 
            $congress_array[$counter]->link = $data; 
            $counter++; 
            break; 
    } 
} 

$xml_parser = xml_parser_create(); 

xml_set_element_handler($xml_parser, "startTag", "endTag"); 

xml_set_character_data_handler($xml_parser, "contents"); 

$fp = fopen($xml_file, "r") or die("Could not open file"); 

$data = fread($fp, filesize($xml_file)) or die("Could not read file"); 

if(!(xml_parse($xml_parser, $data, feof($fp)))){ 
    die("Error on line " . xml_get_current_line_number($xml_parser)); 
} 

xml_parser_free($xml_parser); 

fclose($fp); 

 // A simple for loop that outputs our final data. 
 //echo sizeof($congress_array);
for($x=0; $x<count($congress_array); $x++){ 
    echo "<tr><td scope='row'>" . $congress_array[$x]->subject . "</td>";  
    echo "<td>" . $congress_array[$x]->committee . "</td>"; 
    echo "<td>" . $congress_array[$x]->witness . "</td>"; 
    echo "<td>" . $congress_array[$x]->date . "</td>"; 
    echo "<td>" . $congress_array[$x]->bill . "</td>"; 
    echo '<td><a href="'. $congress_array[$x]->link .'"><img src="download-icon.png" width="20" height="20" alt="' . $congress_array[$x]->subject . '"/></a></td></tr>'; 
} 
?>

找不到文件。。。哪个文件?XML?shtml

在没有看到您的代码的情况下,我只能猜测您的.SHTML包含了一些可执行的PHP,这是令人不安的事情


但是如果没有发布代码,我们所能做的就是猜测,如果您使用Virtual和include,那么在某些情况下,您需要拆分include代码并在.shtml文件的顶部运行它。然后让输出包括您需要输出的地方。为我的问题工作

谢谢