During development, page js often encounters places where the currently logged in user information (menu permissions, basic user information, configuration information) is required. Generally speaking, we may not care too much about how to obtain this information. , but the current front-end is packaged through webpack. Even if code splitting is done, the js files and css files are still very large.
In the case of first loading, there is some room for optimization. The following mainly introduces some ways to obtain information. The interface uses simulated data, and the session acquisition interface is set to a 1 second delay. The following data are all data loaded for the first time, regardless of the 304 situation.
php Chinese website learning topic:php session (including pictures, texts, videos, cases)
The browser accesses app.do, the backend program responds, obtains the user information InitData, obtains the returned app.html text, and writes the user information