When do I need to add a colon to the method before the thinkphp template?

Source: Internet
Author: User
For example, I want to link to the homepage in the navigation:
Written in this way: "{U (' Index/index ')}"
cannot be linked correctly to the homepage.
Written like this: "{: U (' Index/index ')}"
(That is, the U method is preceded by a colon)

But I'm in another place, in a form form:


U method before adding a colon no problem!

Why is that?

Reply content:

For example, I want to link to the homepage in the navigation:
Written in this way: "{U (' Index/index ')}"
cannot be linked correctly to the homepage.
Written like this: "{: U (' Index/index ')}"
(That is, the U method is preceded by a colon)

But I'm in another place, in a form form:

U method before adding a colon no problem!

Why is that?

1, U() is the function that generates the URL in the thinkphp
2, in the template, the use of {:U('home/index')} this method means:
3, if only write {U('home/index')} should be understood as invalid (also may be executed but not echo), not specifically tested, and LZ said in the form without a colon is not a problem may be because this write invalid, no output anything, so it becomes , In the form tag, the action is empty and is submitted to the current page by default. So..

Link description

  • Related Article

    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.