donglun2024 2019-05-10 12:40
浏览 97

php error_log(“”)以下要求

I am trying to print to a log. It will work at the very top of the page but not below a require statement.

This works...

<?php 

$log_file = "../../../../errors.log"; 
$error_message = "test! 
";  
error_log($error_message, 3, $log_file);

require '../../../includes/functions.php'; // Utilities functions


However, this does not...

<?php 

require '../../../includes/functions.php'; // Utilities functions

$log_file = "../../../../errors.log"; 
$error_message = "test! 
";  
error_log($error_message, 3, $log_file);

I have tried both require and require_once. Furthermore, I added the following code to the top of the page to override any mistakes that might have been made in the php.ini file:

<?php 

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require '../../../includes/functions.php'; // Utilities functions

$log_file = "../../../../errors.log"; 
$error_message = "test! 
";  
error_log($error_message, 3, $log_file);


I'm new to php and do not understand what is happening here. I also haven't found any similar reports online...

Any help would be very much appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大