Variable scope in PHP plug-in implementation mechanism

Source: Internet
Author: User
1. if you want to implement the plug-in mechanism in your own blog, the problem is to add hooks on many nodes of the program and then execute the call on the hook. 2. but I have a question: how can I pass the data to the call on the hook? Directly using parameters? I think this is too rigid ,... 1. if you want to implement the plug-in mechanism in your own blog, the problem is to add hooks on many nodes of the program and then execute the call on the hook.

2. but I have a question: how can I pass the data to the call on the hook? Directly using parameters? I think this is too rigid. Is there a flexible way? Or use global?

3. I have been entangled in this question for a long time. please answer the question ^-^

Reply content:

1. if you want to implement the plug-in mechanism in your own blog, the problem is to add hooks on many nodes of the program and then execute the call on the hook.

2. but I have a question: how can I pass the data to the call on the hook? Directly using parameters? I think this is too rigid. Is there a flexible way? Or use global?

3. I have been entangled in this question for a long time. please answer the question ^-^

It is rigid and standard, and a hook has clear parameters, which is good for maintainability and scalability of the program. furthermore, your input parameters are variable. you can use an array encapsulation to implement any desired parameter format.

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.