Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么';这个PHP邮件函数不能工作吗?_Php_Visual Studio 2012 - Fatal编程技术网

为什么';这个PHP邮件函数不能工作吗?

为什么';这个PHP邮件函数不能工作吗?,php,visual-studio-2012,Php,Visual Studio 2012,我正在尝试让这个php工作。我正在visual studio 2012中编写代码(由于我的网络酒店,我不得不这么做)。它似乎无法管理php,我不知道该怎么做才能让它工作。我想我需要下载一些扩展,但是我无法让它工作。我曾尝试下载phpTools,但在安装时找不到visual studio 2012(仅在2015年,甚至在卸载visual studio 2015时也找不到) 在Bin文件夹中有: -Lang.Php.dll -Lang.Php.pdb -Lang.Php.Wp.dll -Lang.P

我正在尝试让这个php工作。我正在visual studio 2012中编写代码(由于我的网络酒店,我不得不这么做)。它似乎无法管理php,我不知道该怎么做才能让它工作。我想我需要下载一些扩展,但是我无法让它工作。我曾尝试下载phpTools,但在安装时找不到visual studio 2012(仅在2015年,甚至在卸载visual studio 2015时也找不到)

在Bin文件夹中有:

-Lang.Php.dll
-Lang.Php.pdb
-Lang.Php.Wp.dll
-Lang.Php.Wp.pdb

<?php
// Check for empty fields
if(empty($_POST['name'])        ||
   empty($_POST['email'])       ||
   empty($_POST['phone'])       ||
   empty($_POST['message']) ||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
    echo "No arguments Provided!";
    return false;
   }

$name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];

// Create the email and send the message
$to = 'yourname@yourdomain.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form:  $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address"; 
mail($to,$email_subject,$email_body,$headers);
return true;            
?>
-Lang.Php.dll
-Lang.Php.pdb
-Lang.Php.Wp.dll
-Lang.Php.Wp.pdb

代码中有什么错误吗?因为我也没有让它在Visual studio 2015中工作-它说缺少一个结束标记。

我格式化了您的代码。与您收到的错误消息相关,它似乎没有任何问题。这真的是错误所在的文件吗?是的。奇怪的可能是因为我的VisualStudio无法正确读取PHP?它是否说缺少哪种类型的结束标记?我记不起来了。我已卸载该版本的Visual studio så,无法再看到该消息。