为什么这个PHP代码显示为常规文本(html)? [英] Why is this PHP code showing up as regular text (html)?

查看:122
本文介绍了为什么这个PHP代码显示为常规文本(html)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直盯着这个将近一个小时,作为最后的手段,我希望你们中的一些人可能会帮我弄清楚这个php代码是否显示为我的html文件中的普通文本?所有帮助都非常感谢。

I've been staring at this for almost an hour and as a last resort I was hoping some of you guys might give me a hand figuring out this php code is showing up as regular text in my html file? All help greatly appreciated.

http://jsfiddle.net/ YYH27 /

<?php
        $name = $_POST['name'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        $from = 'From:'; 
        $to = ''; 
        $subject = 'Hello';
        $human = $_POST['human'];

        $body = "From: $name\n E-Mail: $email\n Message:\n $message";

        if ($_POST['submit'] && $human == '4') {                 
            if (mail ($to, $subject, $body, $from)) { 
            echo '<p>Your message has been sent!</p>';
        } else { 
            echo '<p>Something went wrong, go back and try again!</p>'; 
        } 
        } else if ($_POST['submit'] && $human != '4') {
        echo '<p>You answered the anti-spam question incorrectly!</p>';
        }
    ?>


推荐答案

如果这是在 .html 文件,您需要将您的网络服务器配置为运行html通过PHP

If this is in a .html file, you need to configure your webserver to run html through PHP.

如果您希望JSFiddle运行您的PHP,他们不会这样做。

If you're expecting JSFiddle to run your PHP, they do not do that.

这篇关于为什么这个PHP代码显示为常规文本(html)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆