我已经在谷歌应用引擎上部署了我的应用程序。用户在表单上输入的输入调用 email.php 文件(在代码下面提到)发送一封电子邮件。但是,当我部署它时,当调用 php 文件(email.php)时,脚本没有执行,脚本显示在本地主机中。我已阅读有关配置 app.yaml 文件的其他帖子,但它没有帮助。让我知道必须做什么。
应用程序.yml
application: shop_app
version: alpha-001
runtime: php55
api_version: 1
handlers:
-url: /email.php
script: assets/email.php
.php 文件
<?php
$name = $_POST['fname'];
$lname = $_POST['lname'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
// Create the email and send the message
$to = 'vikraj@gmail.com';
$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\nFirst Name: $name\n\nLast Name:$lname\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n\n$message";
$headers = "From: userjoe@gmail.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);
/* Redirect browser */
header("Location: index.html");
?>