<?php
// This is the file demonstrate the InjectionAOP mode which need set the php.ini with the config to 3:
// xaop.aop_mode = 3
class Swing
{
public function get($name) {
echo 'Swing::get()' . PHP_EOL;
return [1,2,3,4,5]; // to test the after_return aop feature
}
}
// This aop will caught all return value except the null
// So if you use return null, it will be omitted by the kernel, for the kernel default return null
Xaop::addAfterReturnAop(Swing::class, "__get", function(){
echo '_after_return_caught' . PHP_EOL;
// 如何获取返回值?
});
echo '
<?php // This is the file demonstrate the InjectionAOP mode which need set the php.ini with the config to 3: //
';xaop.aop_mode = 3
class Swing { public function get($name) { echo 'Swing::get()' . PHP_EOL; return [1,2,3,4,5]; // to test the after_return aop feature } } // This aop will caught all return value except the null // So if you use return null, it will be omitted by the kernel, for the kernel default return null Xaop::addAfterReturnAop(Swing::class, "__get", function(){ echo '_after_return_caught' . PHP_EOL; // 如何获取返回值? }); echo '/* output: Swing::__get() _after_return_caught /