Minor [PHP framework] 6. Proxy and minorphp framework proxy. Minor [PHP framework] 6. proxy: minorphp framework Proxy 6.1 Proxy Minor provides an implementation similar to the InvocationHandler interface in java and a Proxy-class Proxy mode. for details, see Minor [PHP framework] 6. proxy, minorphp framework proxy
6.1 proxy
Minor provides an implementation similar to the InvocationHandler interface in java and the Proxy mode of a Proxy class. for details, refer to my article: http://www.cnblogs.com/orlion/p/5350752.html
6.1.1 usage
class FooController extends Controller{ public function bar($productName) { $log = new LogHandler(); $shop = new Shop(); $shopProxy = Proxy::newProxyInstance($shop, $log); $shopProxy->buy($productName); }}
before(); $result = $method->invokeArgs($target, $args); $this->after(); return $result; } public function before() { echo '[LogHandler] before
'; } public function after() { echo '[LogHandler] after
'; }}
mail = $mail; } public function buy($productName) { echo '[Shop] buy ' . $productName . '
'; !is_null($this->mail) && $this->mail->send('DemoUser'); }}
Protocol PHP framework] 6. Proxy, minorphp framework Proxy 6.1 Proxy Minor provides an implementation similar to the InvocationHandler interface in java and a Proxy mode of the Proxy class. for details, refer...