欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-06-12 15:57:56
...
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()鍑芥暟浼氭鏌ユ槸鍚﹀瓨鍦ㄤ竴涓瓟鏈柟娉?/span> __sleep.濡傛灉瀛樺湪锛?/span>__sleep()鏂规硶浼氬厛琚皟鐢紝 鐒跺悗鎵嶆墽琛屽簭鍒楀寲鎿嶄綔銆傝繖涓姛鑳藉彲浠ョ敤浜庢竻鐞嗗璞★紝骞惰繑鍥炰竴涓寘鍚璞′腑鎵?鏈夊彉閲忓悕绉扮殑鏁扮粍銆傚鏋滆鏂规硶涓嶈繑鍥炰换浣曞唴瀹癸紝鍒?/span>NULL琚簭鍒楀寲锛屽鑷?/span> 涓?涓?/span>E_NOTICE閿欒銆俖_sleep鏂规硶甯哥敤浜庢彁浜ゆ湭鎻愪氦鐨勬暟鎹紝鎴栫被浼肩殑鎿嶄綔銆傚悓鏃讹紝濡傛灉浣犳湁涓?浜涘緢澶х殑瀵硅薄锛屼笉闇?瑕佷繚瀛橈紝杩欎釜鍔熻兘灏卞緢濂界敤銆?/span>

9銆?/span>__wakeup()

涓?/span>__sleep() 鐩稿弽锛?/span>unserialize()浼氭鏌ユ槸鍚﹀瓨鍦ㄤ竴涓猒_wakeup鏂规硶銆傚鏋滃瓨鍦紝鍒欎細鍏堣皟鐢?/span> __wakeup鏂规硶锛岄鍏堝噯澶囧璞℃暟鎹??/span> __wakeup缁忓父鐢ㄥ湪鍙嶅簭鍒楀寲鎿嶄綔涓紝渚嬪閲嶆柊寤虹珛鏁版嵁搴撹繛鎺ワ紝鎴栨墽琛屽叾瀹冨垵濮嬪寲鎿嶄綔銆?/span>


10銆?/span>__isset()

褰撳鏈畾涔夌殑鍙橀噺璋冪敤isset() 鎴?/span> empty()鏃讹紝__isset() 浼氳璋冪敤銆?/span>

11銆?/span>__unset()

unset涓?涓璞$殑灞炴?ф椂琚皟鐢ㄣ?傚锛?/span>unset($c->name)銆?/span>

12銆?/span>__set_state()

璋冪敤var_export鏃讹紝琚皟鐢ㄣ?傜敤__set_state鐨勮繑鍥炲?煎仛涓?/span>var_export鐨勮繑鍥炲?笺??/span>

13銆?/span>__autoload()

瀹炰緥鍖栦竴涓璞℃椂锛屽鏋滃搴旂殑绫讳笉瀛樺湪锛屽垯璇ユ柟娉曡璋冪敤銆傜畝鍗曠殑璇村氨鏄被鐨勮嚜鍔ㄥ姞杞?/span>;褰撲綘灏濊瘯浣跨敤涓?涓?/span>PHP娌℃湁缁勭粐鍒扮殑绫?/span>, 瀹冧細瀵绘壘涓?涓?/span>__autoload鐨勫叏灞?鍑芥暟. 濡傛灉瀛樺湪杩欎釜鍑芥暟,PHP浼氱敤涓?涓弬鏁版潵璋冪敤瀹?/span>,鍙傛暟鍗崇被鐨勫悕绉般??/span>

14銆?/span>__invoke()

褰撳皾璇曚互璋冪敤鍑芥暟鐨勬柟寮忚皟鐢ㄤ竴涓璞℃椂锛宊_invoke 鏂规硶浼氳鑷姩璋冪敤銆?/span>

榄旀湳甯搁噺:

__LINE__ 鏂囦欢涓殑褰撳墠琛屽彿銆?/span>

__FILE__ 鏂囦欢鐨勫畬鏁磋矾寰勫拰鏂囦欢鍚嶃?傚鏋滅敤鍦ㄨ鍖呭惈鏂囦欢涓紝鍒欒繑鍥炶鍖呭惈鐨勬枃浠跺悕銆傝嚜 PHP 4.0.2 璧凤紝__FILE__ 鎬绘槸鍖呭惈涓?涓粷瀵硅矾寰勶紙濡傛灉鏄鍙疯繛鎺ワ紝鍒欐槸瑙f瀽鍚庣殑缁濆璺緞锛夛紝鑰屽湪姝や箣鍓嶇殑鐗堟湰鏈夋椂浼氬寘鍚竴涓浉瀵硅矾寰勩??/span>

__DIR__ 鏂囦欢鎵?鍦ㄧ殑鐩綍銆傚鏋滅敤鍦ㄨ鍖呮嫭鏂囦欢涓紝鍒欒繑鍥炶鍖呮嫭鐨勬枃浠舵墍鍦ㄧ殑鐩綍銆傚畠绛変环浜?/span> dirname(__FILE__)銆傞櫎闈炴槸鏍圭洰褰曪紝鍚﹀垯鐩綍涓悕涓嶅寘鎷湯灏剧殑鏂滄潬銆傦紙PHP 5.3.0涓柊澧烇級 =

__FUNCTION__ 鍑芥暟鍚嶇О锛?/span>PHP 4.3.0 鏂板姞锛夈?傝嚜 PHP 5 璧锋湰甯搁噺杩斿洖璇ュ嚱鏁拌瀹氫箟鏃剁殑鍚嶅瓧锛堝尯鍒嗗ぇ灏忓啓锛夈?傚湪 PHP 4 涓鍊兼?绘槸灏忓啓瀛楁瘝鐨勩??/span>

__CLASS__ 绫荤殑鍚嶇О锛?/span>PHP 4.3.0 鏂板姞锛夈?傝嚜 PHP 5 璧锋湰甯搁噺杩斿洖璇ョ被琚畾涔夋椂鐨勫悕瀛楋紙鍖哄垎澶у皬鍐欙級銆傚湪 PHP 4 涓鍊兼?绘槸灏忓啓瀛楁瘝鐨勩??/span>

__METHOD__ 绫荤殑鏂规硶鍚嶏紙PHP 5.0.0 鏂板姞锛夈?傝繑鍥炶鏂规硶琚畾涔夋椂鐨勫悕瀛楋紙鍖哄垎澶у皬鍐欙級銆?/span>

__NAMESPACE__ 褰撳墠鍛藉悕绌洪棿鐨勫悕绉帮紙澶у皬鍐欐晱鎰燂級銆傝繖涓父閲忔槸鍦ㄧ紪璇戞椂瀹氫箟鐨勶紙PHP 5.3.0 鏂板锛?/span>

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

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频