Blogger Information
Blog 34
fans 0
comment 0
visits 39170
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
tp3.2 使用composer 加载 Monolog
黄健的博客
Original
1767 people have browsed it

使用composer下好monolog后

1 在入口文件index.php,  在引入之前调用 thinkphp.php

define('APP_DEBUG',true);
// 定义应用目录
define('APP_PATH','./Apps/');
//应用静态目录
define('HTML_PATH','./Html/');
//定义模块的模板目录位置
define('TMPL_PATH','./Tpl/');
// 系统运行时目录
define('RUNTIME_PATH','./Runtime/');
require './vendor/autoload.php';
// 引入ThinkPHP入口文件
require './Core/ThinkPHP/ThinkPHP.php';

2 在需要调用的地方 new一个。需要注意的是,正常是这样 new Monolog\Logger('app'); 但是如果在控app文件夹下调用的话,会带上对应的命名空间。所以需要这样调用 new \Monolog\Logger('app'); 前面加上 ‘\’ 代表根命名空间。 如果直接调用 :比如 Index模块下的 index控制器调用,就是new app\ index\monolog\logger,所以要加上 ‘\’



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post