2017-02-24 71 views
-1

我有一个文件夹名称php在我的桌面上包含文件名index.html,我已经在我的C:// xampp文件夹中安装xampp .Plz告诉我如何构建php文件夹 index.html包含此代码。但此代码不发送电子邮件。在我的文件夹结构中有任何问题phpPHP邮件没有发送为什么?

<!Doctype html> 
<html> 
<head> 
<title>My email Page</title> 
</head> 
<body> 
    <div> 
    <?php 
    $email = "[email protected]"; 
    $subject = "hope this works"; 
    $body = "i think all is well"; 
    $header = "from [email protected]"; 
    mail($email , $subject, $body $header); 
    echo "ok all well"; 
    ?> 
</div> 
</body> 
</html> 
+0

仔细检查您的邮件() – Rhopercy

+0

您必须了解html和php的区别。它不是一样的,PHP必须由你的http服务器专门处理。请在网上搜索一些关于php的基本介绍。 Ther很丰富,并且在这里复制所有内容是毫无意义的。 – arkascha

+0

你是否设置了php.ini文件。如果没有,请通过

回答

0

您需要让您的xampp先运行您的php脚本。因此请将您的index.html更改为index.php。当您通过http://localhost/php/index.php从浏览器访问您的页面时,您可以看到该php代码段是否运行。