简体   繁体   中英

PHP Code not consistently executing using WAMP Server

I have a WAMP Server up and running to test PHP code for a class I am taking. The WAMP Server icon is green, and I have HTML and PHP files in my www folder that run without issue. I also have my WAMP running PHP v7.0.1

I'm having an issue with one particular file, some of the PHP code will execute but not all of it. I'm not able to determine why. I've put this PHP code into online PHP processors and it spits out exactly what it is supposed to (timestamped date). Here is how the PHP is displayed when I run the file in a web browser:

Image of Web Page

Here is the contents of my PHP file:

<html>
<head>
 <title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?php
    echo '<p>Order processed at ';
    echo date('H:1, jS F');
    echo '</p>'
?>
</body>
</html>

`

As you can see, the data echo does not work for some reason. However the echo for order processed works no problem.

Any assistance would be much appreciated. I am new to PHP and web servers and my class only meets once a week. It's been difficult to get help from my Professor and I've been stuck trying to figure this out for a while.

From your screenshots, you're opening the php script like a plain html file :

file:///C:/wamp64/www/procecssorder2.php

You should request the web page from your apache server, most probably via :

http://localhost/procecssorder2.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM