我尝试运行php脚本时出错。我不知道为什么
这是我的php我尝试运行php脚本时出错。我不知道为什么,php,html,Php,Html,这是我的php <?php $to = "jacob@codefarms.us, duma@codefarms.us"; $subject = _POST['name']; $content = __POST['content']; $headers = _POST['email']; if (!$content === "") { mail($to,$subject,$content,$headers);
<?php
$to = "jacob@codefarms.us, duma@codefarms.us";
$subject = _POST['name'];
$content = __POST['content'];
$headers = _POST['email'];
if (!$content === "") {
mail($to,$subject,$content,$headers);
}
?>
我不明白为什么我会出错。我使用hostgator来托管我的网站。您需要添加下划线“
”:
post方法应以下划线“”开头。$\u post['name']是访问post数组中数据的正确方法。\u post?RTM:我想应该是$\u Post有人想回答这个问题吗?(它修复了它)关闭它,这个问题是由一个无法再复制的问题或一个简单的印刷错误引起的。虽然类似的问题可能在这里的主题,这是一个解决的方式不太可能帮助未来的读者。这通常可以通过在发布前确定并仔细检查重现问题所需的最短程序来避免。
Warning: Illegal string offset 'name' in
/*****/*******/codefarms.us/contact.php on line 5
Warning: Illegal string offset 'content' in
/*****/*******/codefarms.us/contact.php on line 6
Warning: Illegal string offset 'email' in
/*****/*******/codefarms.us/contact.php on line 7
$name = $_POST['name'];