![](/img/trans.png)
[英]Can't append rest of string after closing php tags and process php data inside html tags
[英]Can't display HTML tags on error in PHP 7
使用此ini设置:
ini_set("log_errors", 1);
ini_set("display_startup_errors", 1);
ini_set("error_log",APP_LOG);
ini_set("error_reporting", E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
ini_set("log_errors_max_len",1024);
ini_set("docref_root","http://manual/en/");
ini_set("html_errors",1);
我通常会在发生错误时得到HTML标签,而我的PHP版本是7.0.22
尝试在php.ini文件中打开xdebug。 然后重新启动您的Web服务器。
ini_set("html_errors",true)
; 将是正确的设置,设置完后,重新启动php服务器。
如果要在php-7
使用error_handling
,它将以这种方式处理:
try{
// Your code
}
catch(Error $e) {
$trace = $e->getTrace();
echo $e->getMessage().' in '.$e->getFile().' on line '.$e->getLine().' called from '.$trace[0]['file'].' on line '.$trace[0]['line'];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.