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.