test方法里面有几十行代码 正常执行会返回一个url 但有时会报Undefined offset: 0
和Undefined variable: APPID
这样的错误或者其他错误 我想如果test方法某一行代码报错 index方法里面得到一个空字符串 这个应该怎么写?
public function index(){
$number = $this->test();//如果报错我想得到一个空字符串
return $number;
}
public function test(){
......
return $url;
}
可以试试这样写