1
我試圖將文檔發送到打印機。這是我使用的代碼:pfsockopen在屏幕上顯示一個醜陋的錯誤消息,並忽略我的異常處理程序
try
{
$fp = pfsockopen($ip, $port,$errno,$errstr,30);
fputs($fp, $sContent);
fclose($fp);
$this->session->set_flashdata('message_header','Document verstuurd');
$this->session->set_flashdata('message_status','info');
$this->session->set_flashdata('message', 'Uw document is verstuurd naar de printer');
$this->redirect('/goods_receipt/history');
}
catch (Exception $e)
{
$this->session->set_flashdata('message',$e->getMessage());
$this->session->set_flashdata('message_status','danger');
$this->session->set_flashdata('message_header', 'Er is een fout opgetreden');
$this->redirect('/goods_receipt/history');
}
傻傻的我忘了設置IP地址。我本來期望的異常,然後要顯示的提示信息,而是我的客戶看到這個:
我在做什麼錯?
p.s .:請注意我不需要任何幫助,找出錯誤發生的原因。我已經解決了這個問題。我只需要了解爲什麼異常處理程序被忽略,以便下次無法打開套接字時,會顯示一個不太可怕的屏幕。
感謝您的答覆!我的德語很漂亮,但英語相當容易找到。如果它在頁面上說了什麼,並且返回一個錯誤,但它不會。它只是消息與消息。 –
所以這可能有幫助嗎? http://stackoverflow.com/questions/2661546/php-network-getaddresses-getaddrinfo-failed-name-or-service-not-known –
我會接受這個答案,因爲它是最接近的我會得到: - )。我想真正的結論是,pfsockopen不會拋出異常。謝謝你的時間! –