duanlun4411 2014-04-06 11: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 11: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条)

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站