Home>Article>Backend Development> Detailed explanation and cases of PHP proxy mode

Detailed explanation and cases of PHP proxy mode

墨辰丷
墨辰丷 Original
2018-05-16 14:40:00 2040browse

This article mainly introduces the detailed explanation and cases of PHP proxy mode. Interested friends can refer to it. I hope it will be helpful to everyone.

The code is as follows:

Show(); [php] view plain copy Things = $things; } /** * 真实对象的展示方法 * @access public */ function Show(){ echo "专业的人才做{$this->Things}"; } } // 代理对象 Class Proxy implements IProxy { /** * 私有真实对象变量 * @var object */ private $Pro; /** * 构造方法 * @access public * @param string $things 专业的事情 */ function __construct($things){ $this->Pro = new Profession($things); } /** * 代理对象的展示方法 * @access public */ function Show(){ $this->Pro->Show(); } }

Output structure:

Professional talents do professional things

Related recommendations:

Detailed explanation of the proxy mode of JS design pattern

The proxy mode of Javascript

The proxy mode of PHP design ideas The practice of separation from reading and writing

The above is the detailed content of Detailed explanation and cases of PHP proxy mode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use __call() in PHP Next article:How to use __call() in PHP