php 动态调用方法
$searchActionArr = [
'1' => 'searchAlbumList',
'2' => 'searchUser',
'3' => 'searchActivityList',
];
if(filled($searchActionArr[$searchType]) && method_exists($this,$searchActionArr[$searchType])){
$instanceMethod = $searchActionArr[$searchType];
$result = $this->$instanceMethod($searchName);
result = $this->{$searchActionArr[$searchType]}($searchName);
}
或 使用“{}”,参考在php中{}的作用
if(filled($searchActionArr[$searchType]) && method_exists($this,$searchActionArr[$searchType])){
result = $this->{$searchActionArr[$searchType]}($searchName);
}