duanlun4411 2014-04-06 03:30
浏览 122
已采纳

PHP文件无法运行

I have this two files:
index.html

<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>

</body>
</html>

And welcome.php

<html>
<body>

Welcome, <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>

</body>
</html>


This is example from there

When the user fills the form and hits "enter" it should display:

Welcome, the_name_you_enter
Your email address is address_you_enter

But for me it only displays welcome.php source code (I am using Safari 7). Does anyone knows why?

  • 写回答

2条回答 默认 最新

  • doujiekeyan0622 2014-04-06 03:34
    关注

    This usually happens because the PHP file is not executed on a web server or PHP is not enabled on your webserver.

    You are probably trying to access the file directly using file://

    Take a look at MAMP (I am assuming you are using OS X)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部