简体   繁体   English

Google App Engine jQuery无法访问我的php文件

[英]google app engine jQuery can't access my php file

I have a file called functions.php in my google app engine root folder, I use jQuery to post values to this file, but I get a 500 code error. 我的Google App引擎根文件夹中有一个名为functions.php的文件,我使用jQuery将值发布到此文件中,但出现500代码错误。 maybe because of my url handling, it is set to I tried to move my functions.php to a static folder, however it doesnt work at all, the page doesnt even show. 也许是由于我的URL处理,它设置为我试图将我的functions.php移动到静态文件夹,但是它根本不起作用,页面甚至都没有显示。 Any suggestions? 有什么建议么? (Note that it works well on a normal server). (请注意,它在普通服务器上运行良好)。

Here is my full app.yaml code : 这是我完整的app.yaml代码:

application: myapp
version: 1
runtime: php
api_version: 1

handlers:
- url: /css
  static_dir: css
- url: /scripts
  static_dir: css
- url: /assets
  static_dir: assets
- url: /styles
  static_dir: styles    
- url: /includer
  static_dir: includer   
- url: /.*
  script: index.php

All your php files stored in the root folder are redirected to index.php becuase of these lines in code. 存储在根文件夹中的所有php文件都将重定向到index.php因为这些行在代码中。

- url: /.*
  script: index.php

if you have many '.php' files in your root folder than either you make a entry for each of the file in the app.yaml . 如果您的根文件夹中有多个“ .php”文件,而不是在app.yaml为每个文件输入一个条目。 For Example : 例如 :

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

- url: /file1.php
  script: file2.php

- url: /file3.php
  script: file3.php

or you can simply add below lines for all php files. 或者您可以简单地为所有php文件添加以下行。

- url: /(.*)\.php
  script: \1.php

How are you even calling your functions.php file? 您甚至如何调用您的functions.php文件?

In your app.yaml, you do not have the facility to call it! 在您的app.yaml中,您无法调用它!

The only php script that is callable in your app.yaml is index.php (last handler in your app.yaml) 在app.yaml中唯一可调用的php脚本是index.php(app.yaml中的最后一个处理程序)

I suppose you have put functions.php in the static directory 'includer' 我想您已经将functions.php放在了静态目录“ includer”中

Static means static, it will not function as a dynamic file. 静态表示静态,它将不能用作动态文件。

However, if you want to post values to your function.php file, you need to add a new URL like this: 但是,如果要将值发布到function.php文件,则需要添加一个新的URL,如下所示:

- url: /functions/.*
  script: functions.php

place this handler before your last handler 将此处理程序放在最后一个处理程序之前

with this in place, you can post values to yoursite/functions using jquery 有了这个,您可以使用jquery将值发布到您的站点/函数

Use this link for further clarification: https://developers.google.com/appengine/docs/php/config/appconfig 请使用以下链接进行进一步说明: https : //developers.google.com/appengine/docs/php/config/appconfig

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM