duanchongchu5177 2015-01-11 13:00 采纳率: 0%
浏览 24
已采纳

Apache / Wamp / php问题? Chrome显示关闭php标签?>

I have a probably basic but still weird issue - Chrome won't show array properly and displays closing php tag. I'm sure i'm making some very basic error somewhere. I tried enclosing both array keys and values with single and double quotes, changing ending semicolon to colon, but nothing works.

Here is the test page code:

<html>
<head>
</head>

<body>
<?php

$beatles = array(
    "John" => "vocals",
    "Paul" => "bass",
    "George" => "guitar",
    "Ringo" => "drums",
);
?>

</body>
</html>

And here is the output in Chrome:

"vocals", "Paul" => "bass", "George" => "guitar", "Ringo" => "drums", ); ?>**

What am I doing wrong?

  • 写回答

5条回答 默认 最新

  • doujie2356 2015-01-11 13:10
    关注

    First thing, make sure that you are accessing localhost and not the actual file on your computer. Your URL should say "localhost/yourfile.php".

    Then, check and make sure that the file extension that you're loading ends in .php

    Lastly, verify that Apache is setup to use PHP on .php files. You can verify this inside of the httpd.conf.

    To do this,

    1. Left click on the Wamp icon in the bottom right tray of your computer
    2. Apache
    3. Left click httpd.conf
    4. Search for <IfModule mime_module>
    5. Verify that it has this line: AddType application/x-httpd-php .php
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?