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

WBOY
Release: 2016-09-02 08:57:08
Original
1454 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!