经典php代码,10个非常经典的php代码片段.doc

10个非常经典的php代码片段.doc

cf7cd01e8dcfa784d80cd2e7efbae571.gif

还剩

8页未读,

继续阅读

下载文档到电脑,马上远离加班熬夜!

亲,喜欢就下载吧,价低环保!

内容要点:

27. set_error_handler('nettuts_error_handler'); 28. 29. // Trigger an error... (var doesn't exist) 30. echo $somevarthatdoesnotexist; 75. } 76. fclose($conn); 77. } 78. else { die('Error: Could not connect to ' . $nic_server . '!'); } 79. 80. return $output; 81. } 10. 不显示 PHP 错误而发送电子邮件取代之如果你不想在页面中显示 PHP 错误,也可以通过 email 来获取错误信息。下面的代码可以帮助你实现。Php 代码 1. An error ($number) occurred on line 7. $line and in the file: $file. 8. $message "; 9. 10. $email .= "" . print_r($vars, 1) . ""; 11. 12. $headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 13. 14. // Email the error to someone... 15. error_log($email, 1, [email protected]', $headers); 16. 17. // Make sure that you decide how to respond to errors (on the user's side) 18. // Either echo an error message, or kill the entire project. Up to you... 19. // The code below ensures that we only "die" if the error was more than 20. // just a NOTICE. 21. if ( ($number !== E_NOTICE) && ($number < 2048) ) { 22. die("There was an error. Please try again later."); 23. } 24. } 25. 26. // We should use our custom function to handle errors. 31. "int" => "whois.iana.org", 32. "ac" => "whois.nic.ac", 33. "ae" => "whois.uaenic.ae", 34. "at" => "whois.ripe.net", 35. "au" => "whois.aunic.net", 36. "be" => "whois.dns.be", 37. "bg" => "whois.ripe.net", 38. "br" => "whois.registro.br", 39. "bz" => "whois.belizenic.bz", 40.

发表评论

暂无评论,赶快抢占沙发吧。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值