【发布时间】:2017-03-04 15:28:33
【问题描述】:
好的,让我解释一下我遇到了什么问题,
我在 php 中创建了类似 MVC 的结构来创建 Web API,并使用 angular 作为前端。现在我创建了一个登录页面并在按钮单击事件$http.post("user/login") 上执行,在控制台中我得到这样的输出。
它正在输出整个 index.php 内容,现在我想知道我做错了什么?
这是我的 app.js 代码。
这是我的 .htaccess
ErrorDocument 404 p1.html
Header always set Access-Control-Allow-Origin "*"
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php/$1 [QSA,L]
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ p1.html [L]
Options All -Indexes
这是我的 user.php
<?php
class user
{
public static function login(){
echo json_encode(array("in user class model"));
}
}
?>
这是我的 index.php
【问题讨论】:
标签: javascript php angularjs .htaccess