0

If I run this function on another server, the php file actually runs and returns data. When I run this code in a javascript file on google cloud server, I get a string containing the contents of the php file. Is something wrong with my yaml file or is there something else that I am missing? The php file should be throwing some kind of error since I haven't set up the sql database yet.

Here's the AJAX:

$.ajax({
    type: 'POST',
    url: 'php/genjsonphp.php',
    data: { stdt : startformat.toString(), enddt : endformat.toString()},
    success: function(data) {
    try
      {
        successSearch(data);
      }
    catch(err)
      {
          txt="There was an error on this page getting the data points.\n\n";
          txt+="Error description: " + err.message + "\n\n";
          txt+="Click OK to continue.\n\n";
          txt+=data;
          alert(txt);
      }
    }  
});

I see that 'data' is just a String of the PHP file genjsonphp.php.

EDIT: I am running the app on google-app engine. I made a mistake when I tried to describe my question. I believe my error lies in my YAML file. I have a folder that the main index.php file accesses and calls php files (or that's what it's supposed to do). I need to read up on the app.yaml to fix it I think. Here is what the files looks like now:

application: melodic-bolt-364
version: 1
runtime: php
api_version: 1

handlers:
- url: /stylesheets
  static_dir: stylesheets

- url: /javascript
  static_dir: javascript

- url: /fancybox
  static_dir: fancybox

- url: /images_android
  static_dir: images_android

- url: /php
  static_dir: php


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

1 回答 1

3

你在这里有这条线:

- url: /php
static_dir: php

这意味着“将 PHP 目录中的所有内容都作为静态文件提供服务”。相反,试试这个:

- url: /php/genjson
script: php/genjsonphp.php

这将使路径“/php/genjson”执行您的脚本。

于 2013-10-11T17:39:09.940 回答