I am trying to write a handler in google appengine using APP.YAML. I am trying to accomplish the following:
/API/Module/Action/
-> api.php?module=**Module**&action=**Action**
I have tried the following:
- url: /api/(.*)/(.*)
script: api2.php?module=\2&action=\1 # specify a script
Does anyone have any ideas?
Thanks,
我认为应该是:
url: /api/(.*)/(.*)
What is the result you are seeing? You have reversed "module" and "action", and also have to handle that trailing slash. Try:
- url: /api/(.*)/(.*)/
script: api2.php?module=\1&action=\2 # specify a script
Try this:
- url: /api/(.*)/(.*)/
script: api2.php
Then, inside your api2.php
handler:
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$segments = explode('/', $path);
// $segments[0] == "api"
module = $segments[1]
action = $segments[2]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.