从文件中获取变量并将它们放入 HTML 文档中

Getting variables from file and putting them in a HTML document

我正在尝试在一个名为 "post-info.php" 的 php 文件中写入一个数组,它看起来像这样:

<?php
$settings = array(
 'submitter' => 'tester',
 'body' => "How about this: 

&gt; Gigabyte Tri-SLI Liquid Luggage 980s",
);

?>

首先,我希望body是一个多行变量。然后,我希望它被 index.php 文件调用,通过 Markdown 解析器,然后显示。看起来有点像这样:

<!DOCTYPE html>
<?php
include 'Parsedown.php';
$postinfo = include 'post-info.php';
$Parsedown = new Parsedown();
?>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="style.css" rel="stylesheet">
  </head>
  <body>
    <div class="container">
      <div class="jumbotron vertical-center">
        <blockquote>
          <div class="post-body"><?php echo $Parsedown->text($postinfo["body"]); ?></div>
          <hr />
          <p class="post-submitter"><?php include($postinfo["submitter"]); ?></p>
        </blockquote>
      </div>
    </div>
  </body>
</html>

那么,如何让这两个变量显示在那些地方(毫无疑问我写错了)并让多行变量实际显示为多行?

而不是这个

<p class="post-submitter"><?php include($postinfo["submitter"]); ?></p>

尝试使用这个

<p class="post-submitter"><?= $settings["submitter"]; ?></p>

我不知道 Parsedown.php,但是对于原始 php,如果你使用

include 'post-info.php';
//then you can use your $settings variable defined in post-info.php
echo $Parsedown->text($settings["body"]);