為什么總提示多了個(gè)[]
<?php
namespace wh88;
?function sum($a,$b){
?return "{$a} + {$b} =".($a+$b);
?}
?echo sum(2,3);
?echo '<br>';
?//echo call_user_func(要執(zhí)行的函數(shù),參數(shù)1,參數(shù)2.。)
?echo call_user_func(__NAMESPACE__.'\sum',3,10);
?echo '<hr>';
?echo call_user_func_array(__NAMESPACE__.'\sum',[30,40]);
?class test
{
public function sum($a,$b){
?return "{$a} + {$b} =".($a+$b);
?}
?}
?$obj=new test();
?echo '<hr>';
echo call_user_func_array([$obj,'sum'],[22,40]);//當(dāng)使用靜態(tài)方法時(shí)(static),echo call_user_func_array([test::class,'sum'],[22,40]);
//方法重載
class test1
{
public function __call($whl,$qq){
return '跑偏了';
}
}
echo '<hr>';
$obj=new test1();
echo $obj->www(10,100,30);
2022-09-23
沒(méi)有提示呀