Home Backend Development PHP Tutorial php榄旀湳鏂规硶鍜岄瓟鏈彉閲

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

Jun 13, 2016 am 11:03 AM
php sleep span string

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>

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

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

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

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

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

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

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

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,

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

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

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

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

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

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 PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

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.

See all articles