dongxu4023 2014-08-25 08:36
浏览 48
已采纳

从谷歌App Engine中的表单运行PHP脚本

I am new to Google App engine, so stuck. I want to run a php script to process my form in google app engine. I am not sure how to go about it.

This is how I have defined the form:

<form method="post" action="/php/" name="SampleForm">
                            <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER" />
                            <input id="TEST" type="text" name ="EmailAddr" class="text" value="Your email address" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your email address';}">
                            <input type="hidden" name="subject" value="Sample FormMail Testing" />
                            <input type="hidden" name="recipients" value="helloworld@gmail.com" />
                            <input type="submit" value="Submit"  />
                        </form>

and this is my app.yaml :

application: totemic-gravity-676
version: 1
runtime: php
api_version: 1

handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css))
  static_files: \1
  upload: (.*\.(gif|png|jpg|ico|js|css))

- url: /robots.txt
  static_files: robots.txt
  upload: robots.txt 

- url: /
  script: main.php


- url: /php/
  script: formmail.php

what my php script does is that it sends a mail to some email address. I have my formmail.php in the same level as app.yaml. But this does not work. The script can be accessed statically, but when I run it via the form, I get error messages. What could be the problem ?

you may check it in action here :http://totemic-gravity-676.appspot.com/ (scroll down to the update form)

I think I have do something with the -static keyword in my yaml, but I am clueless about how to define a folder as static

  • 写回答

1条回答 默认 最新

  • duanbi1888 2014-08-25 10:25
    关注

    You're script is being called - looks like you're trying to use the mail() function that isn't supported on app engine.

    1. from your app logs.

      /formmail.php 200 350ms 0kb Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 module=default version=1

      W 2014-08-25 19:32:57.768 The function 'mail' is not implemented.

      W 2014-08-25 19:32:57.768 The function 'mail' is not implemented.

      W 2014-08-25 19:32:58.046 The function 'mail' is not implemented.

    2. to send mail on app engine using php

    Mail API Overview

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)