Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果api在子目录怎么办 #5

Closed
tigerohuang opened this issue May 7, 2016 · 3 comments
Closed

如果api在子目录怎么办 #5

tigerohuang opened this issue May 7, 2016 · 3 comments

Comments

@tigerohuang
Copy link

比如我的所有api,希望放在api这个子目录,然后调用:
http://www.xxxx.com/api/hw/

现在提示“File not found.”

我在nginx中配置:
server {
listen 80;
server_name www.xxxx.com;
root /Users/hqr/shopping/m4;

    location / {
        root   /Users/hqr/shopping/m4;
        index  index.php;
    }
    location /api {
        root   /Users/hqr/shopping/m4;
        index  index.php;
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ \.php$ {
        root           /Users/hqr/shopping/m4;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

不知道应该如何配置了

@tigerohuang
Copy link
Author

我想选择这个框架做一个restful api开发,因为项目急着开展,能否帮忙加qq,方便咨询:24671694

@tigerohuang
Copy link
Author

我在nginx,修改了配置:
location /api {
root /Users/hqr/shopping/m4;
index index.php;
try_files $uri $uri/ /api/index.php?$args;
}

去跟踪api/index.php下面的东西,可以访问,但是不对。

http://m4.ehuishou.cn:8090/api/hw/ ,提示

{"error":"caoym\util\exceptions\NotFound","message":""}

@caoym
Copy link
Collaborator

caoym commented May 8, 2016

"caoym\\phprs\\Router": {
        "properties": {
            "url_begin":1 //url_begin用于指定路由的从哪一级开始匹配,默认为0
       } 
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant