我有一个简单的 php 问题。我想包含一个简单的 PHP 文件。我include("filename.php")
用来包含文件。
但问题是,如果文件包含正常,那么它会显示错误,但如果包含的文件中有任何错误,那么它就会死掉并且没有进一步的执行。
我希望如果包含的文件中有任何错误,它只会显示错误并且应该继续进一步执行:
就像在包含文件之后一样,我正在显示footer
. 目前,如果代码中有任何错误,则页脚不显示,如果我想在包含文件有错误时显示页脚。我怎样才能做到这一点 ?
编辑:
<?php
include("header.php");
include("dbconnect.php");
<div class="content">
<div class="container">
<div >
<form name="savecode" action="" method="post">
<div class="span12">
<form action="#" method="post">
<input type="hidden" name="language" value="PHP">
<textarea id="code" name="yourcode" style="width:800px;height:200px;"><?php echo $code;?></textarea>
<br/><input type="submit" class="btn btn-primary" name="reruncode" value ="Run the code">
</div>
<hr/>
<div class="span12">
<h5>Output of the above code</h5>
<textarea id="output" style="width:800px;height:200px;" disabled="disabled">
<?php
include("testfile.php");
?>
</textarea>
<?php
if(isset($_SESSION['email']))
{
$uniquid = md5(uniqid($email,true));
echo "<input type='hidden' id='uniqid' value=$uniquid>";
?>
<input type="hidden" id="email" value="<?php echo $_SESSION['email']; ?>">
<br/><input id="submit" value="Save this code" class="btn btn-primary" />
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
include("footer.php");