문제

Is any way to call new mysqli($host, $user, $pass, $db_name) without printing the following errors?

Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'user'@'127.0.0.1' (using password: YES) in...

I don't like to ignore errors (@ or error_reporting(0)), i would like any other "better practice" way.

도움이 되었습니까?

해결책

Well if you don't want errors to be printed - just tell PHP not to print them.
Configure PHP this way:

display_errors = 0
log_errors = 1

if you want to catch errors in some handler, you have to register it first.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top