[Continued] [PHP Dynamic Call method] with parameter solution

Source: Internet
Author: User
[Continued] [PHP Dynamic Call method] I have always had a problem with parameters. why not understand them? A. phpclassDb {& nbsp; publicstatic $ db_table; & nbsp; pulbicstatic $ db_connection; & nbsp; publicfunction _ construct (name) {& nbsp; Db :: db_ta [continued] [PHP Dynamic Call method] with parameters
In fact, I have always had a problem. Why can't I understand it?
A. php
Class Db {
Public static $ db_table;
Pulbic static $ db_connection;
Public function _ construct (name ){
Db: db_table = name;
}
}

User
A. php? Tbname = video

User B
A. php? Tbname = picture

---------------------
I have seen that the connections in many encapsulated Db objects are put in static.
Is there no problem with concurrent access?

------ Solution --------------------
The database connection word is valid only in the current program.
It doesn't matter where it is stored.


------ Solution --------------------
It doesn't matter .. Direct call.
Repeat the call or instantiate it. Use $ db-> xx
------ Solution --------------------
In php, these two users are in different spaces, each of which has a DB class... and are irrelevant (that is, static attributes are also independent)

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.