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

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

报告相同问题?

悬赏问题

  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?