2
การจัดการข้อผิดพลาด PHP: die () Vs trigger_error () Vs throw Exception
เกี่ยวกับการจัดการข้อผิดพลาดใน PHP - เท่าที่ฉันรู้มี 3 สไตล์: die()หรือexit()สไตล์: $con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } throw Exception รูปแบบ: if (!function_exists('curl_init')) { throw new Exception('need the CURL PHP extension. Recomplie PHP with curl'); } trigger_error() รูปแบบ: if(!is_array($config) && isset($config)) { trigger_error('Error: config is not an array …
119
error-handling
php