Solution to the server unable to load css: 1. When the project is released, clear the cache of the corresponding project on the server; 2. Add a random number after referencing the css and js files; 3. Modify the reference directly css and js file names.
The operating environment of this tutorial: Windows 7 system, css3 version. This method is suitable for all brands of computers.
Recommended: "css video tutorial"
What is the reason why the server cannot load js and css? How to deal with it?
The reasons for this situation:
1. The corresponding cache files in the server project are not cleared, causing the client to read the previously cached js and css files from the server (not Modify the previous code)
2. The client's browser does not clear the cache, or the cache is not cleared cleanly, and there is still a cache. As a result, when browsing the web page, the locally cached css and js files are read. No Go to the server to read the latest css and js files
Solution:
1. In the first case, when a project is generally released, the cache of the corresponding project on the server will be cleared. If I forgot to clear it when I published it. Remember to clear it, because I was like this before and did not clear the cache on the server. As a result, the client still read the cache file on the server, so the modified code did not take effect
2. For the second type of clearing, if it is confirmed that the server cache has been cleared, it is not a server cache problem, then you can consider adding a random number (also called a version number) after referencing the css and js files, such as:
3. The third method, if the above two methods are useless, then congratulations, you have encountered a situation that I have never encountered before. In this case, there must be some modification. This problem can be solved by directly modifying the names of the css and js files you reference. This should definitely be possible.
The above is the detailed content of What should I do if the server cannot load css?. For more information, please follow other related articles on the PHP Chinese website!