This article describes how to use php magic methods (php magic functions). For more information, see
The code is as follows:
/** PHP treats all class methods starting with _ (two underscores) as magic methods. Therefore, when you define your own class methods, do not use _ as the prefix. **/
// _ ToString, _ set, _ get _ isset (), and _ unset ()/*The _ toString
1.2 magic method and latency static binding, 1.2 magic delay static
I. Magic methods:
1. _ get ,__ set
_ Get: getInaccessibleTrigger when attributes (Inaccessible indicates that the property does not exist or you do not have the access permission.)
_ Set: triggered when a value is assigned to an inaccessible attribute.
2. _ isset ,__ unset
_ Isset: triggered when
Php magic variables and magic function examples
Echo 'This is LINE'. _ LINE ';
?>
Output result: This is line 2.The complete path and FILE name of The _ FILE. If it is used in a file to be included, the file name to be included is returned. Starting from PHP 4.0.2, __file _ always contains an absolute path (if it is a symbolic connection, it is an absolute path aft
PHP built-in variables: directory_separatorDirectory_separator is a PHP built-in command that returns the path delimiter associated with the operating system, back on Windows/, and on Linux or Unix-like, that's the difference, This is usually used when you define a file path or upload a directory to save it.
PHP treats all class methods that begin with __ (two underscores) as a magic method. So when you define your own class method, do not prefix __.
Magic variable
PHP provides a large number of predefined constants to any script it runs.
However, many constants are defined by different extensions, and are only present when the extensions are loaded, either dynamically after loading, or they are included at compile time.
There are eight magic constants whose values change as they change position in the code.
For example, the value of __line__ depends
PHP treats all class Methods Starting with _ (two underscores) as magic methods. Therefore, when you define your own class methods, do not use _ as the prefix.
1. _ construct ()
When an object is instantiated, the constructor of this object will be called first;
We know that the PhP5 object model and the function with the same class name are class construc functions. If the construc and _ construc () methods are defined at the same time, phP5 calls _
PHP built-in variable: directory_separator
Directory_separator is a PHP built-in command that returns path delimiters related to the operating system. It returns/on Windows, and regrets/on Linux or Unix-like, it is usually used when defining the path containing files or uploading and storing directories.
PHPPut all__The class method starting with (two underscores) is used as a magic method. So when you define your own class methods, do not use__Is th
JS magic Hall: in-depth explanation of LINK elements and js magic link
I. Preface
We generally use
Due to the large amount of content, the special directory is as follows:
2. Are there end tags?
Iii. Introduction to common attributes
Iv. Details about attribute disabled
1. Attribute and Property disabled
2. Will style files be loaded when disabled is set to true?
3. Will the onload, onerror, and onreadysta
Php built-in variable: DIRECTORY_SEPARATORDIRECTORY_SEPARATOR is a php built-in command that returns path delimiters related to the operating system. It returns/on windows, and regrets/on linux or unix-like, it is usually used when defining the path containing files or uploading and storing directories.
PHP treats all class Methods Starting with _ (two underscores) as magic methods. Therefore, when you define your own class methods, do not use _ as th
1, we open in the mobile phone "beauty camera app" and then we download in the app "Download Magic City Makeup", click the download button can be downloaded free of charge;
2, jump to the "material Center" to find the favorite material and then click into the Details page;
3, then we can start to the magic of the city makeup yo, including pear fall, cherry air release, Yan? di Rong Uighur g
PHP built-in variable: directory_separatorDirectory_separator is a PHP built-in command that returns the path separator associated with the operating system, returns on Windows, and backs up on Linux or Unix-like, that's the difference. It is usually used when defining the include file path or uploading the save directory.
PHP treats all class methods that start with __ (two underscores) as magic methods. So when you define your own class method, don'
Magic function1. __construct ()Called when an object is instantiated,When __construct and a function with a class name are present, __construct is called and the other is not called.2. __destruct ()Called when an object is deleted or when an object operation terminates.3. __call ()Object calls a method,If the method exists, it is called directly;If it does not exist, it will call the __call function.4. __get ()When reading the properties of an object,
Slowly long search night, the moon hanging high.Currently all of PHP's magic methods have a look at these__construct () __destruct () __call () __callstatic () __get () __set () __isset () __unset () __sleep () __wakeup () __toString () __invoke () __set_state () __clone () __debuglnfo ()Why study these magic methods, can enrich our knowledge. That's what programmers do, and when you feel like you need a ce
This article describes how to use php magic methods (php magic functions). For more information, see
This article describes how to use php magic methods (php magic functions). For more information, see
The Code is as follows:
/** PHP treats all class Methods Starting with _ (two underscores) as
In-depth analysis of php magic methods and magic variables, built-in methods and built-in variables. Php built-in variable: DIRECTORY_SEPARATORDIRECTORY_SEPARATOR is a php built-in command that returns the path separator related to the operating system. it is returned on windows, but in linux or un-like
Php built-in variable: DIRECTORY_SEPARATORDIRECTORY_SEPARATOR is a php built-in command that returns path
"Title description":Magic Board Magic Squares"Ideas":Does it feel like eight-digit?The obvious wide search, the state of the magic Plate as an arrangement, then the state is at most \ (8! = 40320\) species, space is acceptable, for the first few permutations can be implemented with comtop (I want to do eight digital when you are aware of this routine), Then accor
Magic Constants1. LineReturns the current line number in the file.2. FILEReturns the full path and file name of the file. If used in the include file, the include filename is returned. Since PHP 4.0.2, FILE always contains an absolute path, and the previous version sometimes contains a relative path.3. FUNCTIONReturns the name of the function (PHP 4.3.0 new addition). From PHP 5 This constant returns the name (case-sensitive) when the function is defi
PHP_007 magic variables and magic function magic variables
PHP provides a large number of predefined constants to any script it runs.
However, many constants are defined by different extension libraries. they only appear when these extension libraries are loaded, dynamically loaded, or included during compilation.
There are eight
Mounts Introduction
Light reading skills, the small series will also think that see the previous trick pumpkin, their skills are very similar. In the aggressive mode believe that the magic chariot can be transformed into other mounts skills mounts: Ice-Feng Wolf king, Meteor Lion, polar bear. If you look at skills alone, the magic chariot does not give you power, but a hidden combination score may help y
Magic constants:1. __line__Returns the current line number in the file.2. __file__Returns the full path and file name of the file. If used in the include file, the include file name is returned. Since PHP4.0.2, __file__ always contains an absolute path, and the previous version sometimes contains a relative path.3. __function__Returns the function name (PHP4.3.0 new). Since PHP5 this constant returns the name of the function when it is defined (case-s
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.