AngularJS [Slim Framework]两个index.php文件在两个不同的文件夹中

Connecting to the slim framework by angularjs like that

app.js

angular.module('myApp').factory('DatabaseFactory', function ($http) {
    return {
        getData: function () {
            return $http.get("app/api/getData");
        }

api/index.php

<?php
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();

$app->get('/getData', function() {
     //WORKS GREAT
});

and it work great but this

other.js

app.factory('UsersFactory', function($http) {
return{
    getProfile: function(){
        return $http.get("app/api/users/getUser");
    }
}

api/users/index.php

<?php
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();

$app->get('/getUser', function() {
     //DON'T WORK ERROR 404!!!
});

and return me error 404 file not found

FOLDERS:

api/Slim/other file

api/index.php

api/users/index.php

Please for help.

1个回答

$app->get('/users/getUser', function() {

});

Should be this

download2565
download2565 它与你的文件夹结构有关
接近 5 年之前 回复
dongye1942
dongye1942 我写了这个仍然无法工作也许用户/索引无法看到Slim文件夹
接近 5 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐