Home >Backend Development >PHP Tutorial >javascript - How to use API
It means that I don’t understand how to use API at all. . . I always see it as convenient for others to use, but I don’t know how to use it myself. . .
It means that I don’t understand how to use API at all. . . I always see it as convenient for others to use, but I don’t know how to use it myself. . .
To put it simply, the API interface is an encapsulation of a certain function. It can be encapsulated into a function or a service. For example, for the user order function, I encapsulated the creation of an order into an API interface. Then mobile APP, PC All high-end websites use the order API interface to realize the function of creating orders.
Any interface API has instructions for use, such as the WeChat payment API interface. You pass the order ID, amount and other parameters, and the interface will help achieve successful payment.
<code><?php /* * *这个函数也可以看作是创建订单的API接口,它的功能是创建订单,参数是用户ID 和订单数据 /* function create_order($user_id=0,$arr_order=[]) { //业务代码,去实现创建订单 } </code>
What API are you referring to?
You can also understand ordinary pages as APIs. This API outputs html code.
Take a bunch of parameters A and replace it with another bunch of parameters B.
Parameter A: {"username":chen,"age":20}
Parameter B: {"status":"ok"}
The intermediate process has been completed