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条)

报告相同问题?

悬赏问题

  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了