Some questions about zencart development recently! I recently used zen & nbsp; cart mall system to do things! See the code! & Nbsp; function & nbsp; Y ($ eventID, & nbsp; $ paramArray & nbsp ;=& nbsp; array () & nbsp; {if you have recently developed zen cart, please contact me if you have any questions!
I recently used the zen cart mall system to do things! See the code!
Function notify ($ eventID, $ paramArray = array ()){
$ Observers = & base: getStaticObserver ();
If (! Is_null ($ observers ))
{
Foreach ($ observers as $ key => $ obs ){
If ($ obs ['eventid'] = $ eventID ){
$ Obs ['oss']-> update ($ this, $ eventID, $ paramArray );
}
}
}
}
Function & getStaticObserver (){
Return base: getStaticProperty ('observer ');
}
In the class, each function is followed by A & what does it mean.
Base: getStaticObserver () indicates a certain type of method! As for adding a prefix & is it a reference?
Why do I add one when defining a method &
Please explain in detail! Share:
------ Solution --------------------
& Reference
The first field indicates a reference.
The second part indicates that this method will return a reference
In the end, $ observers is a reference of base ::$ observer.
Any modification to $ observers will affect base: $ observer
In this way, all the behaviors of using base: $ observer are affected.
This method is not applicable if base: $ observer is not used for scheduling.
Of course, this method is not recommended even if base: $ observer is suitable for scheduling. Too obscure
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