如何在php中禁用警告消息而显示其他消息?

如何在php中禁用警告消息而显示其他消息?,php,Php,使用@来抑制警告。但抑制警告/通知/错误并不是一种可取的方法,相反,您应该尝试调试代码以检查幕后的错误 错误报告()是处理这些错误的另一种方法。使用@符号如下: <?php $html_url = 'http://api.biblia.com/v1/bible/content/LEB.html?passage=John333&style=fullyFormatted&key=fd37d8'; $str_html = file_get_contents($html_url)

使用
@
来抑制警告。但抑制警告/通知/错误并不是一种可取的方法,相反,您应该尝试调试代码以检查幕后的错误


错误报告()
是处理这些错误的另一种方法。

使用@符号如下:

<?php
$html_url = 'http://api.biblia.com/v1/bible/content/LEB.html?passage=John333&style=fullyFormatted&key=fd37d8';
$str_html  = file_get_contents($html_url);

请尝试

主要是文件获取内容(在远程服务器上禁用)。您应该使用PHP Curl从URL获取html内容,那么哪一个更可取?我最近的评论更清楚地说明了在当前上下文中更可取的方法
$html_url = 'http://api.biblia.com/v1/bible/content/LEB.html?passage=John333&style=fullyFormatted&key=fd37d8';
$str_html  = @file_get_contents($html_url);
error_reporting(0);