使用composer 显示错误美化

新建comoser.json

 

{
  "name": "brady_frmwork",
  "description":"php framwork",
  "type":"Framwork",
  "keywords":[
    "php","PHP Framwork"
  ],
  "require":{
    "php":">=7.1.0",
    "filp/whoops":"*"
  }
}

  

composer install 

入口文件引入   打开debug时候 

php

define("ROOT",__DIR__."/");

define('ROOT_PATH',"./");

define('CORE_PATH',ROOT_PATH."Core/");

define('APP_PATH',ROOT_PATH."App/");

define("MODULE","\app");

define('APP_BUGE',true);

include "vendor/autoload.php";

if("APP_DEBUG"){
    ini_set("display_errors","on");

    $whoops = new \Whoops\Run;
    $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
    $whoops->register();
} else {
    ini_set("display_errors","off");
}

ewrwer();


include CORE_PATH."Common/base_helper.php";

include CORE_PATH."Frmwork/App.php";


// 类不存在的时候回自动找到下面的类方法下面
spl_autoload_register("\Core\App::load");

// 启动框架
\Core\App::run();

错误就显示为下面

使用composer 显示错误美化_第1张图片

 

 

 

https://github.com/filp/whoops 

 

https://github.com/brady-wang/myFrm

 

你可能感兴趣的:(使用composer 显示错误美化)