search
Homephp教程php手册PHP的魔术方法(简介),php魔术方法简介

PHP的魔术方法(简介),php魔术方法简介

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)

这些方法的作用如下:

_set(string $name,mixed $value):在对象给未定义或者不可见的属性赋值时被调用,参数name即为需要赋值的属性,value即为需要为属性赋的值。

_get(string $name):在对象访问未定义或者不可见的属性时被调用,参数name即为需要访问的属性名。

_isset(string $name):对未定义或者不可见的属性使用isset()时被调用,参数name即为属性名。

_unset(string $name):对未定义或者不可见的属性使用unset()时被调用,参数name即为属性名。

_call(string $name,array $arguments):在对象调用未定义或不可见的方法时被调用,参数name即为方法名,参数arguments为要传递给方法的参数组成的数组。

注意:这些模式方法的作用就是拦截到访问不存在的对象成员的操作,然后对其做相应的响应,并且这些方法都必须使用public修饰。

 

Statement
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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment