Php 返回html代码的$http.post()
我正在尝试使用angular进行post请求,并将响应作为index.html的html代码。我正在使用Zurb基金会的应用程序。Php 返回html代码的$http.post(),php,angularjs,zurb-foundation,Php,Angularjs,Zurb Foundation,我正在尝试使用angular进行post请求,并将响应作为index.html的html代码。我正在使用Zurb基金会的应用程序。 <!doctype html> <html lang="en" ng-app="application"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"
<!doctype html>
<html lang="en" ng-app="application">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation for Apps</title>
<link href="./assets/css/app.css" rel="stylesheet" type="text/css">
<script src="./assets/js/foundation.js"></script>
<script src="./assets/js/templates.js"></script>
<script src="./assets/js/routes.js"></script>
<script src="./assets/js/app.js"></script>
</head>
<body>
<div class="grid-frame vertical">
<div class="grid-content shrink" style="padding: 0;">
<ul class="primary condense menu-bar">
<li><a><strong>opt1</strong></a></li>
<li><a ui-sref="pros"><strong>opt2</strong></a></li>
</ul>
</div>
<div ui-view class="grid-content" >
</div>
</div>
</div>
</body>
</html>
现在,只要我提交表单,我就能够从表单中正确地获取数据,但由于成功函数运行时控制台中显示index.html的html代码,因此无法正确地发布数据。请建议解决方案,以便我能够从php文件中获取数据
<?php
echo $_REQUEST['username'];
?>
在
login.php
中,在任何html
代码开始之前编写php代码,并在任何html代码开始之前添加die()
login.php
<?php
/*
php code to login
*/
die();
?>
<html>
....
</html>
....
<?php
echo $_REQUEST['username'];
?>
file_get_contents("php://input");
<?php
/*
php code to login
*/
die();
?>
<html>
....
</html>