日期:2014-05-17  浏览次数:20474 次

php榄旀湳鏂规硶鍜岄瓟鏈彉閲?

PHP鎶婃墍鏈変互__锛堜袱涓笅鍒掔嚎锛夊紑澶寸殑绫绘柟娉曞綋鎴愰瓟鏈柟娉曘€傛墍浠ヤ綘瀹氫箟鑷繁鐨勭被鏂规硶鏃讹紝涓嶈浠?/span> __涓哄墠缂€銆?/span>

1銆?/span>__construct()

褰撳疄渚嬪寲涓€涓璞$殑鏃跺€欙紝杩欎釜瀵硅薄鐨勬瀯閫犳柟娉曞皢棣栧厛琚皟鐢紱

鎴戜滑鐭ラ亾php5瀵硅薄妯″瀷鍜岀被鍚嶇浉鍚岀殑鍑芥暟鏄被鐨勬瀯閫犲嚱鏁帮紝閭d箞濡傛灉鍚屾椂瀹氫箟鏋勯€犲嚱鏁板拰__construc()鏂规硶鐨勮瘽锛?/span>php5浼氶粯璁よ皟鐢?/span>__contruct()鑰屼笉浼氳皟鐢ㄥ悓绫诲悕鍑芥暟锛屾墍浠?/span>__contruct()浣滀负绫荤殑榛樿鏋勯€犲嚱鏁帮紱

2銆?/span>__destruct()

鏋愭瀯鍑芥暟浼氬湪鍒版煇涓璞$殑鎵€鏈夊紩鐢ㄩ兘琚垹闄ゆ垨鑰呭綋瀵硅薄琚樉寮忛攢姣佹椂鎵ц銆?/span>

3銆?/span>__get(string $name)

褰撹瘯鍥捐鍙栦竴涓苟涓嶅瓨鍦ㄧ殑灞炴€ф椂琚皟鐢紱濡傛灉璇曞浘璇诲彇涓€涓璞″苟涓嶅瓨鍦ㄧ殑灞炴€х殑鏃跺€欙紝php灏变細缁欏嚭閿欒鐨勪俊鎭€傚鏋滃湪绫婚噷娣诲姞__get鏂规硶锛屽苟涓旀垜浠彲浠ョ敤杩欎釜鍑芥暟瀹炵幇绫讳技java涓殑鍙嶅皠鐨勫悇绉嶆搷浣溿€?/span>

4銆?/span>__set(string $name, mixed $value)

缁欐湭瀹氫箟鐨勫彉閲忚祴鍊兼椂灏嗚璋冪敤

5銆?/span>__call(string $name, array $arguments)

褰撹皟鐢ㄤ竴涓笉鍙闂柟娉曪紙濡傛湭瀹氫箟锛屾垨鑰呬笉鍙锛夋椂锛宊_call() 浼氳璋冪敤銆?/span>

__callStatic(string $name, array $arguments)

褰撳湪闈欐€佹柟娉曚腑璋冪敤涓€涓笉鍙闂柟娉曪紙濡傛湭瀹氫箟锛屾垨鑰呬笉鍙锛夋椂锛宊_callStatic() 浼氳璋冪敤銆?/span>

6銆?/span>__toString()

褰撴墦鍗颁竴涓璞$殑鏃跺€欒璋冪敤锛岃繖涓柟娉曠被浼间簬java鐨?/span>toString鏂规硶锛屽綋鎴戜滑鐩存帴鎵撳嵃瀵硅薄鐨勬椂鍊欏洖璋冭繖涓嚱鏁般€?/span>

7銆?/span>__clone()

褰撳璞¤鍏嬮殕鏃惰皟鐢ㄣ€?/span>

8銆?/span>__sleep()

serialize()鍑芥暟浼氭鏌ユ槸鍚﹀瓨鍦ㄤ竴