rev/sway-expage

模拟 SwayExPage 的行为

v1.1.0 2017-03-12 20:28 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:45:58 UTC


README

模拟 SwayExPage 的行为。

这个库允许你展示漂亮的错误页面,以替代 PHP 错误页面。

##功能

  • 隐藏错误信息供普通用户查看
  • 控制台输出格式化美观
  • 自定义错误页面
  • 日志记录到文件
  • 错误输出显示控制

##安装

composer require rev/sway-expage

这将安装此包的最新版本。需要 Composer 包管理器。

##使用方法 非常简单

use Rev\ExPage;

$exPage = new ExPage\Manager(true,[
    'dirname' => __DIR__,
    'filelog' => 'default.log',
    'template' => 'default',
    'separate' => [
        'errors' => 'errors.log',
        'exceptions' => 'exceptions.log'
    ],
    'cli_view' => [
        'error' => [
            'show_file' => true,
            'show_line' => true,
            'show_scope' => true
        ],
        'exception' => [
            'show_file' => true,
            'show_line' => true,
            'show_trace' => true
        ]
    ]
]);

参数 dirname 指向存储日志文件的目录。如果你希望将日志文件分别存储到异常日志和错误日志中,可以在参数 separate 中进行定义。