php _call and _callStatic
php __call and __callStatic
PHP5?的对象新增了一个专用方法?__call(),这个方法用来监视一个对象中的其它方法。如果你试着调用一个对象中不存在的方法,__call?方法将会被自动调用。
?
__call()?is triggered when invoking inaccessible methods in an object context. __callStatic()?is triggered when invoking inaccessible methods in a static context.
?
class?MethodTest?{
????public?function?__call($name,?$arguments)?{
????????//?Note:?value?of?$name?is?case?sensitive.
????????echo?"Calling?object?method?'$name'?"
?????????????.?implode(',?',?$arguments).?"\n";
????}
????/**??As?of?PHP?5.3.0??*/
????public?static?function?__callStatic($name,?$arguments)?{
????????//?Note:?value?of?$name?is?case?sensitive.
????????echo?"Calling?static?method?'$name'?"
?????????????.?implode(',?',?$arguments).?"\n";
????}
}
$obj?=?new?MethodTest;
$obj->runTest('in?object?context');
MethodTest::runTest('in?static?context');??//?As?of?PHP?5.3.0
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Context is the environment and status information when the program is executed. It can include a variety of information, such as the value of variables, the call stack of functions, the execution location of the program, etc., allowing the program to make corresponding decisions based on different contexts. and perform corresponding operations.

How to use context to implement request caching in Go Introduction: When building web applications, we often need to cache requests to improve performance. In the Go language, we can use the context package to implement the request caching function. This article will introduce how to use the context package to implement request caching, and provide code examples to help readers better understand. What is context? : In the Go language, the context package provides a way to pass between multiple goroutines

How to use context to implement request link tracking in Go. In the microservice architecture, request link tracking is a very important technology that is used to track the delivery and processing of a request between multiple microservices. In the Go language, we can use the context package to implement request link tracking. This article will introduce how to use context for request link tracking and give code examples. First, we need to understand the basic concepts and usage of the context package. The context package provides a mechanism

The context package in the Go language is used to pass request context information in the program. It can pass parameters, intercept requests and cancel operations between functions across multiple Goroutines. To use the context package in Go, we first need to import the "context" package. Below is an example that demonstrates how to use the context package to implement request parameter passing. packagemainimport("context"

How to use context to implement request timeout control in Go Introduction: When we make network requests, we often encounter request timeout problems. A network request that does not respond for a long time will not only waste server resources, but also affect overall performance. In order to solve this problem, the Go language introduced the context package, which can be used to implement request timeout control. This article will introduce how to use the context package to implement request timeout control in Go, and attach corresponding code examples. 1. Understand the context package co

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

How to use Go and context elegantly for error handling In Go programming, error handling is a very important task. Handling errors gracefully improves code readability, maintainability, and stability. The context package of Go language provides us with a very convenient way to handle error-related operations. This article will introduce how to use Go and context elegantly for error handling, and provide relevant code examples. Introduction The error handling mechanism of Go language is implemented by returning an error value.

How to use context to implement request retry strategy in Go Introduction: When building a distributed system, network requests will inevitably encounter some failures. In order to ensure the reliability and stability of the system, we usually use a retry strategy to handle these failed requests to increase the success rate of the request. In the Go language, we can use the context package to implement the request retry strategy. This article will introduce how to use the context package in Go to implement a request retry strategy, with code examples. 1. What is
