PHP proxy mode detailed and case study

Source: Internet
Author: User
This article mainly introduces the PHP proxy model detailed and the case, the interested friend's reference, hoped to be helpful to everybody.

The code is as follows:

<?php//Proxy mode index.php header ("Content-type:text/html;charset=utf-8");    Require_once "proxy.php";    Proxy object $obj = new Proxy ("professional thing");  Show $obj->show ();  [PHP] View plain copy<?php//proxy interface interface Iproxy {function Show (); }//Real object Class profession implements Iproxy {/** * Private professional thing * @var String */Private $Thing            S          /** * Construction Method * @access public * @param string $things professional thing * * function __construct ($things) {      $this->things = $things; }/** * How to display real objects * @access public */function show () {echo "professional talent do {$this->things}"      ; }}//proxy object Class Proxy implements Iproxy {/** * Private real object variable * @var Object */Private $        Pro;          /** * Construction Method * @access public * @param string $things professional thing * * function __construct ($things) {      $this->pro = new Profession ($things);        }/** * Proxy Object Display method * @access public */function show () {$this->pro->show (); }  }

Output structure:

Professional talent to do professional things

Related recommendations:

A detailed description of the proxy mode of JS design mode

Proxy mode for JavaScript

The practice of proxy mode and read-write separation of PHP design idea

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.