First, the Magic function(13)1, __construct ()Called when an object is instantiated, and when __construct and a function with the name of the 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 ()The object calls a method, and if the method exists, it is called directly; if it does not exist, it will call the __call function.4, __get
First, the Magic function(13)1, __construct ()Called when an object is instantiated, and when __construct and a function with the name of the 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 ()The object calls a method, and if the method exists, it is called directly; if it does not exist, it will call the __call function.4, __get
Magic Method __callPHP//file name: index.phpDefine(' A ',__dir__);include'/imooc/loader.php '; Spl_autoload_register (' \\imooc\\loader::autoload ');$Object=New\imooc\Object();Echo $Object->test ("Ouch-hello", 123);//the __call method is called automatically when you call a method that does not exist with test/*Output: String (4) "Test" Array (2) {[0]=>string (9) "Ouch-fed" [1]=>int (123)} try*/PHPfile name: object.phpnamespace Imooc; class Object {
Php magic constants and instance code, and magic Constants
Php magic Constants
Instance:
Class MoShu {public function moshu () {echo 'current class Name :'. _ CLASS __. "
The result is as follows:
Current Class Name: MoShu Current Method Name: moshu number of lines in the current file: 10 absolute path of the current file: D: \ xampp \ htdocs \ test \ moshu.
For PHP loading operations and other two magic methods, load magic
Load class// Include ("./Ren. class. php ");// Include "./Ren. class. php ";Include_once ("./Ren. class. php ");Include_once ("./Ren. class. php ");$ F = new Ren ();$ F-> test ();Require ("./Ren. class. php ");Require_once ("./Ren. class. php ");Require_once "./Ren. class. php ";$ F = new Ren ();$ F-> test ();Automatic loading class// 1. All
The magic of canvas and the magic of canvas
Canvas has a magic method, getImageData. It can obtain and change the color values of no pixel in the image within the canvas.
If you have various filter algorithms. You can use canvas to convert the image filter to a function similar to meitu xiuxiu.
Usage:
1: import the image to the canvas first.
2: var canvasData = c
Conversion of python Black Magic Code and python Magic Code
When we use libraries in other languages for encoding and conversion, there are usually only two (or three) Types of characters that cannot be understood ):
Throw an exception
Replace with a replacement character
Skip
However, in the complex real world, due to various unreliable texts, there will always be some discord factors such as mixe
PHP built-in variable: directory_separator
Directory_separator is a PHP built-in command that returns the path separator associated with the operating system, returned on Windows, and returns 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
This article provides a detailed analysis of the magic constants and magic methods in PHP5.
This article provides a detailed analysis of the magic constants and magic methods in PHP5.
Magic constant:1. _ LINE __Returns the current row number in the file.2. _ FILE __Re
This article mainly introduces the PHP magic function and Magic constants related knowledge introduction, the need for friends can refer to, hope to help everyone.
PHP Magic function
1. __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. __destr
Cleverly reload the magic method _ call (), and reload the magic _ call. Cleverly reload the magic method _ call () and reload the magic _ call for six months. I feel that I have learned more things in the past six months than I have learned in the university for four years, the main reason is the calm down, and the go
Example of php magic constants: php magic constants. Php magic constant example introduction, php magic constant php provides a lot of predefined constants to any script it runs, common php magic constants include _ CLASS____FUNCTI php m
It will be the end of this year, Huawei has put a big move, launched the glorious Magic mobile phone. Presumably a lot of people have already started. The first thing to start with is to install a SIM card. So, how about the Glory Magic SIM card? Below, and small weave together to see the Glory Magic installed SIM card method.
First, Glory
at LINQ ·, And I will know about it. · find out the Header element that meets the condition (which is the condition. · Query MSDN · go
Button
///
private void btnBack_Click(object sender, RoutedEventArgs e) { ((App)(Application.Current)).RedirectTo(new Music()); }
Click here to determine the click position
///
Keyboard to play
private void UserControl_KeyDown(object sender, KeyEventArgs e) { string stringKey = e.Key.ToString(); if (stringKey.Contains("N
Chapter 1 of refactoring-experience reconstruction magic RefactorSample, magic baby logging experience
The lab has been settled, and the environment and atmosphere are very good. Today, the teacher invited Sun, manager of Zhuo Er in Beijing, to talk a lot. The biggest surprise is that Mr. Ren is a cloud computing engineer, java is bound to be connected to cloud computing.
After a month, I did not write my b
Magic RAC macro, magic RAC macroFirst, let's talk about the macros that must be known in RAC.
RAC (TARGET, [KEYPATH, [NIL_VALUE])
Usage:
RAC (self. outputLabel, text) = self. inputTextField. rac_textSignal; RAC (self. outputLabel, text, @ "show me when nil is received") = self. inputTextField. rac_textSignal;
This macro is the most commonly used. RAC () always appears on the left side of the equal sign, a
PHP magic methods (Introduction) and php magic methods
Public void _ set (string $ name, mixed $ value)
Public mixed _ get (string $ name)
Public bool _ isset (string $ name)
Public void _ unset (string $ name)
Public mixed _ call (string $ name, array $ arguments)
The functions of these methods are as follows:
_ Set (string $ name, mixed $ value): this parameter is called when an object assigns valu
defined in the task.• 148195-an error was displayed when the engine tried to relocate on the last parked record when the view was refreshed in an offline program.• 157636-magic xpa crashed when executing a rich client offline program from a menu if the menu nesting level was greater than 3.• 166547-the color and font files in the server cache were overwritten when dealing with multiple clients with different DPIs.• 166745-subform initialization in cr
Magic Timer, magic Timer
In a recent project, timing functions are needed in some places. during the design process, I suddenly found that the. net Timer class still has many features that I have never used before. I will share them with you here.
Note: The Timer class here refers to the System. Threading. Timer class.
Scenario 1: The server needs to perform an operation at every day.
When I first thought
PHP // file name: index.php Define (' A ',__dir__); include '/imooc/loader.php '; Spl_autoload_register (' \\imooc\\loader::autoload '); $Object new \imooc\Object(); Echo $Object; // An object cannot be output directly from a string, and when the object is converted to a string, it automatically callbacks the __tostring method /* output: haha/ haha * /phpnamespace Imooc; // file name: object.php class Object { function __tostring ()/// when the object is converted to a string, it will
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.