简单的PHP联系表格与Firebase托管 [英] Simple PHP contact form with Firebase hosting
问题描述
我尝试使用以下方法测试PHP是否可以从我的Firebase主机上运行:
$ b (index.html)
< form action =welcome.phpmethod =post>
< input type =submit>
< / form>
(welcome.php)
<?php
$ to =my@email.com;
$ subject =我的主题;
$ txt =Hello world!;
$ headers =From:dummy@email.com;
邮件($ to,$ subject,$ txt,$ headers);
?>
每当我尝试这个时,浏览器都会试图打开PHP文件而不是处理它。 Firebase服务器托管简单的PHP是否可以像这样处理一个简单的表单?如果我能这样做,我会正确地建立表格,包括验证等。
谢谢,
来自 Firebase托管网站(重点我们将所有的静态内容(html,js,图片等)提供给我们的所有人。 一个安全的SSL连接并在CDN上提供。
Firebase托管用于托管静态资产。 Firebase目前不提供任何方式在Firebase的服务器上执行您的代码。
I'm trying to test out if PHP works from my Firebase hosting using the following:
(index.html)
<form action="welcome.php" method="post">
<input type="submit">
</form>
(welcome.php)
<?php
$to = "my@email.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: dummy@email.com";
mail($to,$subject,$txt,$headers);
?>
Every time I try this the browser keeps on attempting to open the PHP file rather than processing it. Is simple PHP enabled on the Firebase server hosting to process a simple form like this? If I can get it to work this way, I will be building the form out correctly including validation etc.
Thanks,
From the Firebase Hosting site (emphasis mine):
We deliver all of your static content (html, js, images, etc.) over a secure SSL connection and serve it on a CDN.
Firebase Hosting is for hosting static assets. Firebase currently doesn't offer any way to execute your code on Firebase's servers.
这篇关于简单的PHP联系表格与Firebase托管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!