Ask everyone, using PHP tags to generate some HTML tags of the hyperlink (HREF/SRC) compared to directly written out of the efficiency problem?

Source: Internet
Author: User
Sometimes it may be that the path is different from the offline. It would be similar to writing

//某个.php文件
  
   main.css" rel="stylesheet">

But I was thinking, oh, sometimes you have to make the site static. So that's not going to work? If you want to make the Web page static, how to solve the problem of the line offline path different? What is the easiest way to solve this problem? Just like the Jade Direct template in node. js?

Also is if a page nested a lot of such tags will make the page load efficiency is lower?

Just learned PHP soon qaq. Not a wide range of insights. Ask for explanations

Reply content:

Sometimes it may be that the path is different from the offline. It would be similar to writing

//某个.php文件
  
   main.css" rel="stylesheet">

But I was thinking, oh, sometimes you have to make the site static. So that's not going to work? If you want to make the Web page static, how to solve the problem of the line offline path different? What is the easiest way to solve this problem? Just like the Jade Direct template in node. js?

Also is if a page nested a lot of such tags will make the page load efficiency is lower?

Just learned PHP soon qaq. Not a wide range of insights. Ask for explanations

Like this HTML-filled PHP tag running speed is actually very fast, the speed effect can be completely ignored.
So you can write a config.php, declare the various paths inside.
Like what


  
   

You can then use the. htaccess auto include or manually include this file. This way, you can update the path of the entire project as long as you change the config.php.

As long as you don't have an antique version of PHP that supports short tags, you can write it short:


  
   

If you're upset, you can write your own script. All the constants are replaced with the desired address, and it's good to run it again when you redeploy.

Just saw you again asked how the whole update is like compiling.

To say a stupid way, replace the entire project folder search with the one you want.
At the time of development, fill it out , copy the code all over when you deploy it, and replace each variable with a script.

The main purpose is to improve the migration of code and some development problems.
Like saying you can use one to represent installed, why do you have to use a constant to express it?
1. Improve readability
2. Although the standard fixed can not be changed, but also have to change the time, then if the use of 1 is estimated to be able to change you want to die.
The same problem.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.