简体   繁体   中英

PHP die throwing different error message than I want it to

I have a Javascript function which calls a PHP script on my server. In case of failures, the JS function is expecting to receive a message of save_failed from the script.

For testing purposes, I put the wrong database info in the line below so that it fails:

mysql_connect("hostname", "user", "pass") or die('save_failed');

However, the JS function was not behaving as expected, and it seemed it wasn't receiving save_failed as the output. To confirm, I displayed the message being received as an alert box and this is what I got.

Why is the php script not throwing just save_failed and how can I make it do that?

JS函数收到消息

You have Xdebug installed and further errors are occurring.

In production, you should have error_reporting(0) and ini_set('display_errors', '0') .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM