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
Copy codeThe 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 method allows a class to decide how it will react when it is converted to a string._ Set () is run when writing data to inaccessible members._ Get () is utilized for reading data from
is defined (case-sensitive).Example:
function Test () {
Echo ' function name is: '. __method__;
}
Test ();
?>
Copy CodeThe output is: The function is named: Test__NAMESPACE__ the name of the current namespace (case sensitive). This constant is defined at compile time (PHP 5.3.0 is new).Example:
namespace MyProject;
Echo ' namespaces are: ' ', __namespace__, ' '; Output "MyProject"
Zjut1005 magic
This question is to solve the fantasy party
Note: The key is to determine the location of the next digit. The rule is: 1. Each digit in the future can only be filled in the next column (as a) in the next row of its location ), if a already has a number, enter the next number on the current number (that is, the previous position in the same column as this number)
#include#include#define nmax 101int num[nmax][nmax];int main() {#ifndef ONL
PHP Magic Constants Detailed
Example:
Class moshu{public
function Moshu () {
echo ' current class name: '. __class__. "
The results are as follows:
Current class name: Moshu
Current method name: Moshu
The number of rows in the current file: Ten
Current file absolute path: D:\xampp\htdocs\test\moshu.php
folder for the absolute path where the current file resides: D:\xampp\htdocs\test
return class Name:: Method Name: Moshu::moshu
Thank
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
Copy Code code as follows:
/** PHP treats all class methods that start with __ (two underscores) as magic methods. So when you define your own class method, don't prefix it with __. * */
__tostring, __set, __get__isset (), __unset ()/*The __tostring method allows a class to decide how it'll react when it's converted to a string.__set () is the run when writing the members of the data to inaccessible.__get () is utilized to reading data from i
1, we turn on the computer lighting magic hand software, and then you we click on the "Open" button
2, then we can choose to add a border of the icon, select Good after clicking on the photo to open
3, then we opened the photo, and then click on the navigation "border" as shown in the following image
4, you will we can in the Drop-down menu to choose the border mode you want, such as the small series selected "pattern Border
In fact, the front 111CN Small series also introduced a Shadow magic hand of a border effect, here, if you see the previous article for this actually will also effect.
1, the puzzle function in the software navigation, we click on the Open software, and then click the "Jigsaw" button, we enter the Free Jigsaw dialog box. We can choose a canvas background and a set border.
2, we select more than one picture, and then use random typesetting, adju
It's hard to explain what you want to do. In short, with _ callstatic, you can save a lot.Code. In addition, this method can be called in the subclass. In combination with get_called_class, The subclass also performs magic.
Previously, when using the. NET Component Castle's activerecord,. Net version 2.0 can add a static getbyid method to each subclass. Now, PHP can also do this..
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.