如何在浏览器中打印日志文件CodeIgniter?

时间:2018-09-18 08:32:04

标签: php codeigniter

我在文件夹logs / log.php中有这样的日志文件

ERROR - 2018-09-17 06:51:03 --> Severity: Warning --> Illegal string offset 'Catatan' /var/www/html/minilos/application/views/minilos/form_akkk.php 483
ERROR - 2018-09-17 06:51:03 --> Severity: Warning --> Illegal string offset 'Catatan' /var/www/html/minilos/application/views/minilos/form_akkk.php 483
ERROR - 2018-09-17 06:51:03 --> Severity: Warning --> Illegal string offset 'Rekomendasi' /var/www/html/minilos/application/views/minilos/form_akkk.php 502
ERROR - 2018-09-17 06:51:03 --> Severity: Warning --> Illegal string offset 'Rekomendasi' /var/www/html/minilos/application/views/minilos/form_akkk.php 502
ERROR - 2018-09-17 06:51:03 --> Severity: Warning --> Illegal string offset 'name' /var/www/html/minilos/application/views/minilos/form_akkk.php 507
ERROR - 2018-09-17 06:51:03 --> Severity: Warning --> Illegal string offset 'name' /var/www/html/minilos/application/views/minilos/form_akkk.php 507
ERROR - 2018-09-17 06:51:03 --> Severity: Warning --> Illegal string offset 'name' /var/www/html/minilos/application/views/minilos/form_akkk.php 509

我正在使用CodeIgniter 2.2.6

如何在浏览器中打印日志文件?

1 个答案:

答案 0 :(得分:1)

只需抓住并回显内容即可。

$file = file_get_contents('/path/to/your/log/file');
echo $file;