【问题标题】:my app.yaml on google cloud is not working well我在谷歌云上的 app.yaml 运行不正常
【发布时间】:2018-11-23 18:10:28
【问题描述】:

我正在做一个网页,这个网页在php上有一个表单,脚本js可以获取表单的值,然后将其发送到其他php,我在google cloud上这样做

app.yaml 是

runtime: php55
api_version: 1

handlers:
- url: /
  script: index.php

- url: /index\.html
  script: index.php

- url: /css
  static_dir: css

- url: /js
  static_dir: js

- url: /server/(.+\.php)$
  script: \1

- url: /img
  static_dir: img

索引、css、js 和 img 工作正常,但服务 php 脚本不工作

我的表单

<form method="post" id="formdata" action="">
     <div class="form-group">
         <label for="user">User</label>
         <input type="text" class="form-control" id="User"name="User" aria-describedby="UserHelp" placeholder="Enter Username" required>
      </div>
      <div class="form-group">
          <label for="Password1">Password</label>
          <input type="password" class="form-control" id="Password" name="Password" placeholder="Password" required>
      </div>
      <div class="text-center">
           <button id="botonEnviar"type="submit" class="btn btn-primary">Login</button>
      </div>
</form>

我的脚本 js

$("#botonEnviar").click( function() {alert("0"); if(validaForm()){ **$.post("server/buscarUsuario.php",$("#formdata").serialize(),function(res)**{ //$("#formulario").fadeOut("slow"); if(res == 1){alert("3"); window.location.href = "https://www.google.com"; . } else { if(res == 99){alert("4"); $("#fracaso").delay(500).fadeIn("slow"); } } }); } });

我想将帖子发送到 buscarUsuario.php ,它位于服务器文件夹中,但网页上这样说 发帖https://***.com/server/buscarUsuario.php 404 () 我不知道该怎么办

【问题讨论】:

    标签: javascript php google-cloud-platform


    【解决方案1】:

    根据您在上一句中所说的,我知道您在名为“server”的文件夹下有“buscarUsuario.php”文件。如果是这种情况,它应该在你的 .yaml 文件所在的根服务器下,因为它是在处理程序script: \1 中编写的。如果您希望文件位于服务器文件夹中,您应该将处理程序设置为script: /server/\1

    【讨论】:

      猜你喜欢
      • 2020-10-03
      • 1970-01-01
      • 2021-04-27
      • 2019-05-26
      • 2017-07-23
      • 2021-07-15
      • 2015-04-19
      • 2020-06-23
      • 1970-01-01
      相关资源
      最近更新 更多