<?php /** * @throws Exception */ function curl() { throw new \Exception('errr'); } /** * getUserInfo */ function getUserInfo() { try { curl(); return true; } catch (Exception $exception) { return true; } finally { return false; } } $rel = getUserInfo(); var_dump($rel);
finally一定会被执行
finally中return会覆盖try和catch的return