[英]Angularjs and PHP for CRUD operations
I have tried to look for tutorials on this but nothing simple and to the point... 我试图寻找有关此的教程,但并没有简单到重点...
Could anyone give me an example or link me to a tutorial on how to post data with angularjs to a php page? 谁能给我一个例子或将我链接到有关如何使用angularjs将数据发布到php页面的教程?
And also with angularjs call a php file to get data in order to display a list of lets say a phonebook. 并且还可以使用angularjs调用php文件来获取数据,以便显示电话簿列表。
How can this be done with angularjs? 如何用angularjs完成? I can do all this with php but i want to know how to do it with Angularjs to visualize and call php files and those PHP files would read/write on the db. 我可以用php完成所有这些操作,但是我想知道如何使用Angularjs来可视化和调用php文件,而那些PHP文件将在数据库上读/写。
I want to use plain php(no php frameworks for now). 我想使用普通的php(目前没有php框架)。
Thanks 谢谢
You can do it making in PHP a couple of RESTfull services for the CRUD operation, for this you can use a Framework like Slim . 您可以通过在PHP中为CRUD操作提供几个RESTfull服务来实现,为此您可以使用Slim之类的框架。
Then in AngularJs you can make a service like this for access the data: 然后,在AngularJs中,您可以提供如下服务来访问数据:
app.factory('phoneService', ['$resource',
function ($resource) {
return $resource('../app/phone/:id',{id : '@id'},
{ 'findOne': { method: 'GET', params : {id : '@id'}}, isArray:false },
{ 'delete' : { method: 'DELETE', params : {id : '@id'}}, isArray: false },
{ 'save' : {method: 'POST', params : {id : '@id'}}, isArray: false }
);
}
]);
May be it will help you.It is a simple search form submission. 可能对您有帮助。这是一个简单的搜索表单提交。
http://www.keyboardninja.eu/webdevelopment/a-simple-search-with-angularjs-and-php http://www.keyboardninja.eu/webdevelopment/a-simple-search-with-angularjs-and-php
http://devzone.co.in/angularjs-simple-example-post-data-php-page/ http://devzone.co.in/angularjs-simple-example-post-data-php-page/
After a long search, I've found a simple and best guide for AngularJS beginners. 经过长时间的搜索,我为AngularJS初学者找到了一个简单而最佳的指南。 This example AngularJS application contain the following functionalities. 此示例AngularJS应用程序包含以下功能。
If you are looking for a simple AngularJS application with step-by-step guide, must check this tutorial - AngularJS CRUD Operations with PHP and MySQL 如果您正在寻找带有分步指南的简单AngularJS应用程序,则必须查看本教程- 使用PHP和MySQL进行AngularJS CRUD操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.