我已经将一个站点移动到GCE w / LAMP,我的PHP正在输出额外的字符

My code looks like this:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>

and outputs this:

Hello World

'; ?>

What are those extra characters doing there?

Thanks!

You can't end a file in .html and expect your web server to parse it as PHP.

In that case it's sent directly to the browser without anything being parsed or executed as PHP.

Instead, save it as index.php for example, then view it in your browser. If you have PHP installed then you should get the output you expect.

Seems like you have saved your file with .html extension instead of .php.