Home  >  Article  >  Backend Development  >  javascript - How to set up the php backend for a single page application?

javascript - How to set up the php backend for a single page application?

WBOY
WBOYOriginal
2016-09-02 08:57:081306browse

Front end:
vue + vue-router(html5 history api) + vue-cli

Backend:
yii2

When I first started, I accessed the built things (index.html and static) as static resources. But in this case, I have no way to generate cookies (such as csrf tokens) when accessing index.html. In this case, what strategy should I adopt to ensure that users can generate cookies on the backend and return them when they visit this page?

Reply content:

Front end:
vue + vue-router(html5 history api) + vue-cli

Backend:
yii2

When I first started, I accessed the built things (index.html and static) as static resources. But in this case, I have no way to generate cookies (such as csrf tokens) when accessing index.html. In this case, what strategy should I adopt to ensure that users can generate cookies on the backend and return them when they visit this page?

json web token

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn