how to catch pg_connect() function error?

前端 未结 2 1805
我在风中等你
我在风中等你 2020-12-31 13:47

pg_connect() is showing the error in table format.Instead of showing error message as table format need a error message alert.

Error Message

2条回答
  •  死守一世寂寞
    2020-12-31 14:12

    To hide the error text generated by PHP, add @ in front of the function call, e.g.:

    $conn = @pg_connect("host=$HOST dbname=$DBNAME user=$USER ".
                       "password=$PASSWORD sslmode=disable");
    

    More details here

提交回复
热议问题