class Test{
use \DeathSatan\Macro\Macro;
}
Test::macro('test',function ($a){
return $a;
},true);
Test::macro('demo',function ($a){
return $a;
},false);
var_dump(Test::test(123));//123
var_dump((new Test)->demo(321));//321
macro's Introduction
macro's People
macro's Issues
Call to undefined method Test::test()
在实例中:
<?php
require_once './vendor/autoload.php';
class Test{
use \DeathSatan\Macro\Macro;
}
Test::macro('test',function ($a){
return $a;
},false);
Test::macro('demo',function ($a){
return $a;
},false);
var_dump(Test::test(123));//123
var_dump((new Test)->demo(321));//321
报以下错误
Fatal error: Uncaught Error: Call to undefined method Test::test() in C:\Users\ChengYao\Desktop\Web\php\vendor\death_satan\macro\src\Macro.php on line 42
Error: Call to undefined method Test::test() in C:\Users\ChengYao\Desktop\Web\php\vendor\death_satan\macro\src\Macro.php on line 42
Call Stack:
0.0002 403272 1. {main}() C:\Users\ChengYao\Desktop\Web\php\index.php:0
0.0058 630840 2. Test::test(123) C:\Users\ChengYao\Desktop\Web\php\index.php:17
0.0058 631216 3. Test::__callStatic($name = 'test', $arguments = [0 => 123]) C:\Users\ChengYao\Desktop\Web\php\index.php:17
运行环境
PHP 8.0.2 (cli) (built: Feb 3 2021 18:36:37) ( NTS Visual C++ 2019 x64 )
Copyright (c) The PHP Group
Zend Engine v4.0.2, Copyright (c) Zend Technologies
with Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick Rethans
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.