1
//This is my html code
//ajtest.html:
<html lang = "en " ng-app>
<head>
<title>Testing database with angular js</title>
<style>
input.ng-invalid(border:1px solid red;}
</style>
</head>
<body>
<form action ="ajdbtest.php" method = 'post'>
username : <input type = "text" name = 'uname' ng-model="user.uname" required>
password : <input type = "password" name = 'pass' ng-model="user.pass" required>
<tr>
<td> Email ID</td>
<td><input type="email" name="prid" value="" ng-model = "user.prid" required /></td>
<td><input type="email" name="paid" value="" ng-model = "user.paid" required /></td>
</tr>
<tr>
<input type = 'submit' value = "submit">
</form>
</body>
</html>
//here is my php code :
<?php
$data = json_decode(file_get_contents("php://input"),TRUE);
$uname = mysql_real_escape_string($data->uname);
$pass= mysql_real_escape_string($data->pass);
echo $uname;
echo $pass;
?>
錯誤是: 說明:試圖獲得非對象的屬性在C:\ XAMPP \ htdocs中\ ajdbtest.php第5行Angular js,PHP發生了什麼事?
說明:試圖獲得非對象的屬性在C: \ XAMPP \ htdocs中\ ajdbtest.php第6行 這到底是怎麼Happenening我是一個新的國際展覽局請幫我..
何時使用joson解碼?你能給我提供任何類型的參考資料,以便我可以更好地學習AJ,感謝幫助欣賞了很多 –
爲什麼你想使用'json_decode'?你知道,這不是強制性的。有JSON數據解碼時應該使用它。 (例如,'$ http'服務默認發佈JSON編碼的數據)。如果你認爲AJ是AngularJS,你可以從官方教程開始(這有點令人驚歎)。最近文檔已經得到了不可思議的改進,所以它們是一個相當不錯的後裔資源。除此之外,還有很多教程 - 我不能推薦任何內容:全部閱讀,然後你就會知道哪些是好的:D('egghead.io'的視頻教程也是一個很好的介紹)。 – gkalpak