| sam 的个人资料>>> 這也將會過去 <<<照片日志列表 | 帮助 |
|
1月28日 Adobe Fireworks TutorialsAdobe Fireworks Tutorials
Web 2.0 Style Text With Fireworks
http://www.jdavidmacor.com/2006/12/28/create-web-20-style-text-with-macromedia-fireworks/ Master the Web 2.0 Style Reflection
http://www.jdavidmacor.com/2007/01/05/master-the-web-20-style-reflection/ How to create shiny 2.0 badges with Adobe Fireworks
http://www.jdavidmacor.com/2006/08/13/how-to-create-shiny-20-badges-with-adobe-fireworks/ Fireworks Aqua
http://imasters.uol.com.br/artigo/3417?cn=3417&cc=85 Fireworks How To: The Ultimate Aqua Button
1月22日 好用的工具 Web Developer (Firefox Addone)Web Developer https://addons.mozilla.org/zh-TW/firefox/addon/60
[CSS/Edit Css] 可以修改CSS,直接看到效果 [Miscellaneous/Display Ruler]
用來測量尺寸大小和位置
[Outline]
1月2日 在php上實做動態代理(Dynamic Proxy)的機制參考這兩篇
http://caterpillar.onlyfun.net/Gossip/SpringGossip/DynamicProxy.html http://caterpillar.onlyfun.net/Gossip/DesignPattern/ProxyPattern2.htm 在php上實做動態代理(Dynamic Proxy)的機制 單純展現實做原理 請另行整理擺放架構 另外可以參考Java的一些概念做變種
<<深入了解Java ClassLoader、Bytecode 、ASM、cglib>>
可以看 cglib 那一段
Java下的框架编程(5)--cglib的应用
AOP編程入門--Java篇
前面又加了Factory包起來
程式碼:
================================================================================================
<?php /* InvocationHandler.php */ require_once('InvocationHandler.php'); class Proxy { public $h; public $delegate; public $enumDirect; static function newInstance($delegate, InvocationHandler $h, array $enumDirect=array()) { $rtn = new Proxy(); $rtn->h = $h; $rtn->delegate = $delegate; $rtn->enumDirect = $enumDirect; return $rtn; } function __call($name, $args) { if(in_array($name, $this->enumDirect)) {
call_user_func_array(array($this->delegate, $name), $args); } else { $this->h->invoke($this, $name, $args); } }
} ?> ================================================================================================ <?php /* Proxy.php */ require_once('InvocationHandler.php'); class Proxy { public $h; public $delegate; public $enumDirect; static function newInstance($delegate, InvocationHandler $h, array $enumDirect=array()) { $rtn = new Proxy(); $rtn->h = $h; $rtn->delegate = $delegate; $rtn->enumDirect = $enumDirect; return $rtn; } function __call($name, $args) { if(in_array($name, $this->enumDirect)) {
call_user_func_array(array($this->delegate, $name), $args); } else { $this->h->invoke($this, $name, $args); } }
} ?> ================================================================================================
<?php /*
test.php
*/
require_once 'InvocationHandler.php'; require_once 'Proxy.php'; /* * http://caterpillar.onlyfun.net/Gossip/DesignPattern/ProxyPattern2.htm * http://caterpillar.onlyfun.net/Gossip/SpringGossip/DynamicProxy.html */ interface ISpeaker { function say($str); } class Speaker implements ISpeaker {
public function say($str) { echo "==$str==<br />\r\n"; } } class Loger
{ public function log($str) { echo("log:$str<br>\r\n"); } } class LogHandler extends InvocationHandler {
protected $loger; function __construct() { $this->loger = new Loger(); } public function bind($delegate) { //return Proxy::newInstance($delegate, $this, array('say')); return Proxy::newInstance($delegate, $this); } public function invoke(Proxy $proxy, $name, array $args) { $this->loger->log("preSay"); if(method_exists($proxy->delegate, $name)) { ////[deprecated] ////http://www.php.net/manual/en/function.call-user-method.php ////call_user_method($name, $this->delegate, $args); ////[deprecated] ////http://tw2.php.net/manual/en/function.call-user-method-array.php ////call_user_method_array($name, $this->delegate, $args); //http://tw2.php.net/manual/en/function.call-user-func-array.php call_user_func_array(array($proxy->delegate, $name), $args); }
$this->loger->log("postSay"); } } function __main__()
{ $logHandler = new LogHandler(); $speakerProxy = $logHandler->bind(new Speaker()); $speakerProxy->say("Hello"); } __main__(); ?> 初探php namespace 反射想法
php namespace
想想開始學php的也是如此
|
|
|