How to properly nest PHP in HTML

Source: Internet
Author: User
If you want to nest PHP code in HTML, there is usually no problem. But in a conditional statement you also need a conditional statement, how do you want to write it?

Such as:


  
                               

下载列表

....

As above, in determining whether a cookie exists, it is also necessary to determine whether $list exists. But it's a mistake to write.

Don't know what the solution is?

Reply content:

If you want to nest PHP code in HTML, there is usually no problem. But in a conditional statement you also need a conditional statement, how do you want to write it?

Such as:


  
                               

下载列表

....

As above, in determining whether a cookie exists, it is also necessary to determine whether $list exists. But it's a mistake to write.

Don't know what the solution is?

Http://www.php1.cn/article/7279.html look at this first, MO-Hurry.

If you don't understand, write the entire paragraph of the PHP statement and then use ECHO to enter the HTML tag tag is too faint.
or use a template.

Landlord can look at PHP alternative syntax specification: http://php.net/manual/zh/control-structures.alternative-syntax.php

I ran no error, ah, what you reported the wrong stickers out.

If the substitution syntax is not good, change back to the basic syntax


  
                       

下载列表

....

But this really does not faint ....

Like your judgment of a cookie, the individual thinks it should be put in 逻辑层 , and should not be left behind 显示层 . So the code structure will be very bad, to the back of the poor maintenance.

  • 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.