简体   繁体   中英

How to call API from frontend/backend application in Yii?

So Yii structure is like this.

api
  |modules
     |v2
         |actions
common
frontend
backend

We can call common in backend and frontend. Also we are able to call backend modules in frontend module.

Is it possible to call API ie v2 action from frontend module in yii?

This is required to be done as API module is already there. And so for avoiding backend logic we need to call API.

You can use the SOA(Service oriented Architecture) in the Yii, for this you have to create the services folder in that service write your logics that can be used by your backend and API's both so your frontend will be API based and backend will be service based. Like as below

api
|modules
|v2
|actions
common
frontend
backend
services

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM