OData的PHP开发包,示例代码:
/*connecttotheODataservice*/$svc=newNorthwindEntities(NORTHWIND_SERVICE_URL);/*getthelistofCustomersintheUSA,foreachcustomergetthelistofOrders*/$query=$svc->Customers()->filter("Countryeq'USA'")->Expand('Orders');$customerResponse=$query->Execute();/*getonlyCustomerIDandCustomerName*/$query=$svc->Customers()->filter("Countryeq'USA'")->Select('CustomerID,CustomerName');$customerResponse=$query->Execute();/*createanewcustomer*/$customer=Customers::CreateCustomers('channel9','CHAN9');$proxy->AddToCustomers($customer);/*committhechangeontheserver*/$proxy->SaveChanges();点击空白处退出提示
评论