Sometimes some online and offline things may have different paths. it will be similar to writing {code ...} but I am thinking, sometimes it is necessary to make the website static. is this method not applicable? If the web page must be static, how can we solve the problem of different online and offline paths? There is something simple... sometimes the path of some online and offline things may be different. It will be similar to this.
// A. php file
Main.css? 7.1.1 "rel =" stylesheet ">
But I was wondering, sometimes it is necessary to make the website static. Isn't this method applicable? If the web page must be static, how can we solve the problem of different online and offline paths? Is there any easy way to solve this problem? It's like jade in node. js is directly rendered by a template?
In addition, if a page is nested with many tags like this, will the webpage loading efficiency be reduced?
I just learned php QAQ soon. I have little knowledge.
Reply content:
Sometimes some online and offline things may be stored in different paths.
// A. php file
Main.css? 7.1.1 "rel =" stylesheet ">
But I was wondering, sometimes it is necessary to make the website static. Isn't this method applicable? If the web page must be static, how can we solve the problem of different online and offline paths? Is there any easy way to solve this problem? It's like jade in node. js is directly rendered by a template?
In addition, if a page is nested with many tags like this, will the webpage loading efficiency be reduced?
I just learned php QAQ soon. I have little knowledge.
Php labels filled with html are actually very fast to run, and the impact of running speed can be completely ignored.
So you can write a config. php file that declares various paths.
For example
Then you can use. htaccess to automatically include or manually include this file. In this way, you only need to modify the config. php file to update the path of the entire project.
As long as php does not support short tags in the antique version, you can write the following brief:
If you are unhappy, you can write a script to replace all the constants with the desired address, and run it once during redeployment.
I just saw that you asked how to update the entire file as compiled.
If you are stupid, search the entire project folder. Replace it with what you want.
Enter During deployment, all the code is copied and each variable is replaced with a script.
The main purpose is to improve code migration and some development issues.
For example, we can use 1 to indicate that it has been installed. Why do we have to use a constant to express it?
1. improve readability
2. Although the standard is fixed, it cannot be changed, but when there are changes that have to be made, you may want to die if you use 1.
The same is true for this problem.