欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP魔術(shù)方法之__call與__callStatic使用方法

 更新時間:2017年07月23日 23:00:50   作者:北京流浪兒  
這篇文章主要介紹了PHP魔術(shù)方法之__call與__callStatic方法,需要的朋友可以參考下

核心代碼

//魔術(shù)方法__call 
/* 
$method 獲得方法名 
$arg 獲得方法的參數(shù)集合 
*/
class Human {
 private function t(){

 }

 public function __call($method,$arg){
  echo '你想調(diào)用我不存在的方法',$method,'方法<br/>'; 
  echo '還傳了一個參數(shù)<br/>'; 
  echo print_r($arg),'<br/>'; 
 }

 public static function __callStatic($method,$arg){
  echo '你想調(diào)用我不存在的',$method,'靜態(tài)方法<br/>'; 
  echo '還傳了一個參數(shù)<br/>'; 
  echo print_r($arg),'<br/>'; 
 }
}


$ha = new Human();

//example1
$ha->t(1,2,3);

echo '<br>';
//example2
$ha->say('a','b','c');

echo '<br>';
//example3
$ha::run('d','e','f');

你想調(diào)用我不存在的方法t方法
還傳了一個參數(shù)
Array ( [0] => 1 [1] => 2 [2] => 3 )

你想調(diào)用我不存在的方法say方法
還傳了一個參數(shù)
Array ( [0] => a [1] => b [2] => c )

你想調(diào)用我不存在的run靜態(tài)方法
還傳了一個參數(shù)
Array ( [0] => d [1] => e [2] => f )

相關(guān)文章

最新評論