Some questions about the object-oriented development of PHP

Source: Internet
Author: User
Some problems in object-oriented development of PHP
The following code is a method in a class:
Public Function GetHead () {
$map = Array (
' A.state ' =>array (' eq ', 1),
' A.recommend ' =>array (' eq ', 1)
);
$prefix = C (' Db_prefix ');
$data = $this->table ("{$prefix}auction as A")
Join ("{$prefix}accessory as AC on a.goods_pic = Ac.id")
Join ("{$prefix}accessory as ACC on a.agopic = Acc.id")
Field (' A.*,ac.path,acc.path as Agopath ')->where ($map)
Find ();
return $data;
}

In the following code $this->table ("..."), no defined table () method can be found anywhere! Why do you ask for advice?
$data = $this->table ("{$prefix}auction as A")
Join ("{$prefix}accessory as AC on a.goods_pic = Ac.id")
Join ("{$prefix}accessory as ACC on a.agopic = Acc.id")
Field (' A.*,ac.path,acc.path as Agopath ')->where ($map)
Find ();
------Solution--------------------
The class in which your method resides is inherited from a database base class (or it may be a base class)
If you do not find the definition of the table method in this class (or his parent class), then you must define a __call method
  • 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.