test方法里面有幾十行代碼 正常執行會返回一個url 但有時會報Undefined offset: 0
和Undefined variable: APPID
這樣的錯誤或者其他錯誤 我想如果test方法某一行代碼報錯 index方法里面得到一個空字符串 這個應該怎么寫?
public function index(){
$number = $this->test();//如果報錯我想得到一個空字符串
return $number;
}
public function test(){
......
return $url;
}
可以試試這樣寫