我正在尝试将包含一些 php 代码的整个 html 字符串回显到 html 页面,问题是,我无法将字符串存储到 php 变量中;
prependapp.php
<?php
include("db.php");
include("tolink.php");
$result=mysql_query("select * from messages order by msg_id desc");
$row=mysql_fetch_array($result);
$id=$row['msg_id'];
$msg=$row['message'];
$date=$row['date_sent'];
$msg= nl2br($msg);
$msg="<br>{$msg}<br>{$date}";
$app = <<<EOD
<li class="bar<?php echo $id; ?>">
<div align="left" class="post_box">
<span style="padding:10px"><?php echo $msg; ?> </span>
<span class="delete_button"><a href="#" id="<?php echo $id; ?>" class="delete_update">X</a></span>
<span class='feed_link'><a href="#" class="comment" id="<?php echo $id; ?>">comment</a></span>
</div>
<div id='expand_box'>
<div id='expand_url'></div>
</div>
<div id="fullbox" class="fullbox<?php echo $id; ?>">
<div id="commentload<?php echo $id; ?>" >
</div>
<div class="comment_box" id="c<?php echo $id; ?>">
<form method="post" action="" name="<?php echo $id; ?>">
<textarea class="text_area" name="comment_value" id="textarea<?php echo $id; ?>">
</textarea><br />
<input type="submit" value=" Comment " class="comment_submit" id="<?php echo $id; ?>"/>
</form>
</div>
</div>
</li>
EOD;
echo $app;
?>
html页面内的javascript
<script>
$(document).ready(function() {
$("#formID").validationEngine({
ajaxSubmit: true,
ajaxSubmitFile: "update_ajax.php",
success : function() {
alert("success exe!");
$("ol#update").load("prependapp.php");
$("ol#update li:first").slideDown("slow");
document.getElementById('content').value='';
$('#content').value='';
$('#content').focus();
alert("success exe");
},
failure : function() { alert("success fail"); }
})
});
</script>
我前面的“测试”总是显示问题是 $app 没有,我有什么办法可以将带有一些 php 代码的大型 html 代码添加到我的 html 页面中?