PDA

View Full Version : error handling



Vahid Faraji
چهارشنبه 10 شهریور 1389, 23:49 عصر
نظرتون در مورد این کد چیه؟ خطاها رو به کاربر نشون نمی ده و در یک فایل ذخیره می کنه.
این که جایی از کد اشکال داره یا نه؟
این که روش درستی هست یا نه؟ روشهای بهتر کدومند؟


<?php
error_reporting(E_ALL);
ini_set('display_errors',0);
function error($e_code,$e_desc,$e_file,$e_line){
$error_message = "error code:$e_code\n description:$e_desc, error file:$e_file, error line:$e_line". "\r\n-------------------------\r\n";
error_log($error_message, 3, "err.log");
}

set_error_handler('error');
$conn=mysql_connect($host,$userName,$pass);
if(!$conn)
{
die($message);
}
?>