如何在.php文件中编写呈现给可查看网页的php

时间:2022-10-20 22:29:56

I'm trying to write a basic example of php that I want to be viewed on my website. In other words I want the following code to be viewable but I would also like a copy of it to be executable on the webpage:

我正在尝试编写一个我希望在我的网站上查看的基本php示例。换句话说,我希望以下代码可以查看,但我也希望它的副本可以在网页上执行:

<body>
    <p>
      <?php
      $food = array("Bananas", "Toast", "Eggs", "Bacon");
      echo "I like " . $food[0] . ", " . $food[1] . 
               " and " . $food[2] . " and " . $food[3] . "."; 
      ?>
   </p>
</body>

1 个解决方案

#1


1  

<?php and ?> makes code inside to execute, use &lt;?php and ?&gt;

使代码内部执行,使用<?php和?>

#1


1  

<?php and ?> makes code inside to execute, use &lt;?php and ?&gt;

使代码内部执行,使用<?php和?>