3 format of the form action submit address when using thinkphp

Source: Internet
Author: User
2016.06.29
1. Description of the problem
Today, using thinkphp as a user login and registration interface, the Action property does not know how to fill in when submitting the form

Note: I am using the ThinkPHP3.2.3 version of the different version should have a difference

2. Resolution process
Method 1): localhost/..../index.php/module/Controller/method/parameter ....
Even with the full URL address, point to where you want to submit. Because I didn't know how to do it at first, I used this most awkward method ....
Method 2): {: U (' module/controller/method/parameter ')}
The U method is a built-in method for constructing URLs THINKP. Refer to the Thinkphp Development manual for detailed use.
Method 3): __module__/controller/method/parameter,
__controller__/method/Parameter,
__action__/parameters,

Even with system constants to simplify the address, thinkphp provides a number of system constants to hold the current URL address.

For example: __root__ website root directory address

__app__ Current application (entry file) address
__module__ the URL address of the current module
__controller__ the URL address of the current controller
__action__ the URL address of the current operation
__self__ Current URL Address
3. Summary
The general submission form simply specify which PHP file to submit to, and write out the file address. However, when using thinkphp, the submission form will indicate which controller of the module is submitted to which method, or index.php the default controller and method files, otherwise it will be an error.
In addition to the online query solution found that almost all of the answers I find are using the __rul__/method/parameters, and then query ThinkPHP3.2.3 manual found that there is no __url__ this system constant. After your own testing, __rul__ is equivalent to __controller__, which is the address of the current controller.
Many methods of online query are the previous version of the method, the novice just started using the latest version, the online check is always a face confused force ah. In use or should pay attention to the version, the timeliness of information is very important.

The above describes the format of the form action submit address when using thinkphp, including the contents of the content, I hope to be interested in PHP tutorial friends helpful.

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