我想將變量$ all放在$ code的中間,這是從另一個文件中收集的HTML代碼。我目前的代碼是這樣的。如何在另一個內部渲染變量?
ob_start();
---code here---
$all = ob_get_clean();
$code = file_get_contents("file.txt");
echo $code;
file.txt看起來有點像這樣。
<html>
<head>
<title>Title</title>
</head>
<body>
---HTML code here---
$all
---More HTML code---
</body>
</html>
我該怎麼做,以便當我回顯$ code時,$ all會被渲染到裏面?
http://php.net/manual/messageformatter.formatmessage.php – KingCrunch 2012-04-11 14:35:51
你有一個標記能夠真正識別「正確的中間位置」是什麼? $ all實際上都在file.txt中,所以你知道從哪裏開始放置$ all的內容? – used2could 2012-04-11 14:37:53