Php Angular 1.x-无法使用xampp从本地主机运行

Php Angular 1.x-无法使用xampp从本地主机运行,php,angularjs,xampp,Php,Angularjs,Xampp,我建立了一个角度(1)的应用程序,在前端工作良好。我尝试添加一些后端功能,但问题开始出现了。我知道一些php,我想用xampp(5.6.19)运行这个应用程序。我将项目移动到localhost文件夹,安装了xampp和'php'(7.0.13)。我知道这个设置是有效的,因为我拥有的其他应用程序运行良好,除了新的,无法理解哪里出了问题。层次结构如下所示: 我试图通过浏览localhost/myApp来运行它,然后在控制台中出现许多错误: GET http://localhost/styles/s

我建立了一个角度(1)的应用程序,在前端工作良好。我尝试添加一些
后端
功能,但问题开始出现了。我知道一些
php
,我想用
xampp
(5.6.19)运行这个应用程序。我将项目移动到
localhost
文件夹,安装了
xampp
和'php'(7.0.13)。我知道这个设置是有效的,因为我拥有的其他应用程序运行良好,除了新的,无法理解哪里出了问题。层次结构如下所示:

我试图通过浏览
localhost/myApp
来运行它,然后在控制台中出现许多错误:

GET http://localhost/styles/style.css net::ERR_ABORTED
localhost/:22 GET http://localhost/templates/chatRoom/chatRoomController.js net::ERR_ABORTED
localhost/:28 GET http://localhost/js/directives/onEnter.js net::ERR_ABORTED
localhost/:25 GET http://localhost/js/services/chatService.js net::ERR_ABORTED
localhost/:27 GET http://localhost/js/directives/msg.js net::ERR_ABORTED
localhost/:23 GET http://localhost/templates/login/loginController.js net::ERR_ABORTED
localhost/:22 GET http://localhost/templates/chatRoom/chatRoomController.js net::ERR_ABORTED
localhost/:23 GET http://localhost/templates/login/loginController.js net::ERR_ABORTED
localhost/:25 GET http://localhost/js/services/chatService.js net::ERR_ABORTED
localhost/:27 GET http://localhost/js/directives/msg.js net::ERR_ABORTED
localhost/:28 GET http://localhost/js/directives/onEnter.js 404 (Not Found)
angular.js:11630 GET http://localhost/templates/login/login.html 404 (Not Found)
(anonymous) @ angular.js:11630
sendReq @ angular.js:11423
serverRequest @ angular.js:11133
processQueue @ angular.js:15757
(anonymous) @ angular.js:15773
$eval @ angular.js:17025
$digest @ angular.js:16841
$apply @ angular.js:17133
bootstrapApply @ angular.js:1713
invoke @ angular.js:4625
doBootstrap @ angular.js:1711
bootstrap @ angular.js:1731
angularInit @ angular.js:1616
(anonymous) @ angular.js:30709
trigger @ angular.js:3127
defaultHandlerWrapper @ angular.js:3417
eventHandler @ angular.js:3405
angular.js:13424 Error: [$compile:tpload] Failed to load template: ../templates/login/login.html (HTTP status: 404 Not Found)
我的
index.html
文件如下所示:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>title</title>
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
    <link rel="stylesheet" href="/styles/style.css">
</head>
<body ng-app="app" ng-controller="mainCtrl">
    <ui-view></ui-view>
</body>
<!-- angular scripts -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular.js"></script>
<script src="node_modules/@uirouter/angularjs/release/angular-ui-router.js"></script>
<!-- controllers -->
<script src="app.js"></script>
<script src="/templates/chatRoom/chatRoomController.js"></script>
<script src="/templates/login/loginController.js"></script>
<!-- services -->
<script src="/js/services/chatService.js"></script>
<!-- directives -->
<script src="/js/directives/msg.js"></script>
<script src="/js/directives/onEnter.js"></script>
</html>

为什么找不到这些文件?

从参考文件
js
css
中删除它们所指向的尾部斜杠

http://localhost/js/ 
而不是

http://localhost/myApp/js/
将头部部分更改为以下内容

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>title</title>
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
    <link rel="stylesheet" href="styles/style.css">
</head>
<body ng-app="app" ng-controller="mainCtrl">
    <ui-view></ui-view>
</body>
<!-- angular scripts -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular.js"></script>
<script src="node_modules/@uirouter/angularjs/release/angular-ui-router.js"></script>
<!-- controllers -->
<script src="app.js"></script>
<script src="templates/chatRoom/chatRoomController.js"></script>
<script src="templates/login/loginController.js"></script>
<!-- services -->
<script src="js/services/chatService.js"></script>
<!-- directives -->
<script src="js/directives/msg.js"></script>
<script src="js/directives/onEnter.js"></script>

标题

从参考文件
js
css
中删除后面的斜杠,因为它们指向
http://localhost/js/
而不是
http://localhost/myApp/js/
谢谢,大多数错误都已消失,但它找不到我拥有的几个模板的templateUrl。我已经更新了原来的问题,请看一看。这是因为您在那里有带有相对URL的路径,您必须更改路径并从中删除尾随的
。/
@undroi
http://localhost/myApp/js/
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>title</title>
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
    <link rel="stylesheet" href="styles/style.css">
</head>
<body ng-app="app" ng-controller="mainCtrl">
    <ui-view></ui-view>
</body>
<!-- angular scripts -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular.js"></script>
<script src="node_modules/@uirouter/angularjs/release/angular-ui-router.js"></script>
<!-- controllers -->
<script src="app.js"></script>
<script src="templates/chatRoom/chatRoomController.js"></script>
<script src="templates/login/loginController.js"></script>
<!-- services -->
<script src="js/services/chatService.js"></script>
<!-- directives -->
<script src="js/directives/msg.js"></script>
<script src="js/directives/onEnter.js"></script>