TP operation method defect solution (continued)

Source: Internet
Author: User
That is, the suffix can be defined for the operation method. if the above parameter is configured, the actual operation method we call is to add the operation name with the Run suffix, assume that the URL address we are currently accessing is the defect solution of the TP operation method we mentioned before. now we have a simpler solution in version 3.1, you only need to configure the ACTION_SUFFIX parameter. Obviously, it is much simpler than the behavior extension method. for example:
  1. 'Action _ SUFFIX '=> 'run'
Copy the code to define the suffix for the operation method. if the above parameter is configured, the actual operation method we call is to add the suffix "Run" to the operation name, assume that the URL we are currently accessing is:
  1. Http: // localhost/index. php/User/list
Copy the code to access the list operation of the User module. before ACTION_SUFFIX is configured, the list method may conflict with the built-in php method, the actual access should be the listRun method of the UserAction controller:
  1. Class UserAction extends Action {
  2. Public function listRun (){
  3. // Operation method code
  4. }
  5. }
Copy the code. of course, you can configure any string as the suffix of the operation method. the configuration parameter of ACTION_SUFFIX does not affect the use of the current operation name, and does not affect the call of Method A and method R. However, it should be noted that the operation name suffix should not conflict with the controller class suffix, otherwise it will be called again.
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.