php榄旀湳鏂规硶鍜岄瓟鏈彉閲
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>聽

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
