Home php教程 php手册 ThinkPHP学习笔记调试模式与日志记录

ThinkPHP学习笔记调试模式与日志记录

Jun 13, 2016 am 10:54 AM
thinkphp and Revise Dividing line Can and exist study log yes model of notes Record debug conduct match need

在华丽的分割线之下是需要修改和可以进行配置的具体实现方法:

 

cong.php

 

[php]  

return array(  

  

//更换模式最好删除一些~app.php和~runtime.php  

  

//'配置项'=>'配置值'  

//因为开启URL重新不论是被重写的还是没被重写的,都可以通过原有路径访问  

//如果想开启rewrite模式,需要做如下操作  

//1.query服务器已经开启了Apache的rewrite模块  

//  LoadModule rewrite_module modules/mod_rewrite.so  

//2.在与主入口文件,统计目录下,新建一个.htaccess(vi:save .htaccess;记事本:".htaccess")  

//如果选用模式2(rewrite)会加大服务器的消耗  

'URL_MODEL'=>1,  

  

'URL_PATNINFO_MODEL'=>2,  

//pathinfo包含两类  

    //1普通模式:加上m和a:顺序关系可以发生变化  

    //http://localhost/MyThinkPHP/admin.php/m/index/a/index  

    //传值  

    //http://localhost/MyThinkPHP/admin.php/m/index/a/index/username/zhangsan/password/password  

    //2智能识别模块操作(默认模式就是智能识别)  

    //http://localhost/MyThinkPHP/admin.php/index/index  

    //传值  

    //http://localhost/MyThinkPHP/admin.php/index/index/username/zhangsan/password/password  

          

  

//修改URL分隔符  

//'URL_PATHINFO_DEPR'=>'-',  

  

//修改模板左右定界符  

'TMPL_L_DELIM'=>'',  

  

  

//********************************非常华丽的分割线**************************************  

  

//开启调试模式  

//1.模拟linux系统来识别大小写  

//2.方法名的大小写与模板文件大小写有关  

'APP_DEBUG'=>true,  

//可以自定义页面的Trace信息  

//配置文件路径的Trace信息配置在Thinkphp/Tpl下的pageTrace.tpl.php  

//自定义方式:  

//'TMPL_TRACE_FILE'=>APP_PATH.'/Public/trace.php',  

//或者自定义个trace.php页面放入当前的Conf文件夹中  

  

//默认调试文件的位置:  

//ThinkPHP/Common/debug.php  

//不缓存数据库字段;如果开启,再修改可以将Runtim/Data下面的文件进行删除  

//'DB_FIELDS_CACHE'=> false,  

//可以自定义的debug.php放入当前的Conf文件夹中  

  

//先将APP_DEBUG设置为false然后在加入下面参数  

//'APP_DEBUG'=>false,  

//显示运行次此页面需要的时间  

//'SHOW_RUN_TIME'=>true,  

//显示详细的运行时间(基于SHOW_RUN_TIME)  

//'SHOW_ADV_TIME'=>true,  

//显示数据库的操作次数(基于SHOW_RUN_TIME)  

//'SHOW_DB_TIMES'=>true,  

//显示缓存的操作次数(基于SHOW_RUN_TIME)  

//'SHOW_CACHE_TIMES'=>true,  

//显示内存的开销(基于SHOW_RUN_TIME)  

//'SHOW_USE_MEM'=>true,  

  

  

  

//设置模板  

//'DEFAULT_THEME'=>'default',  

  

  

  

//日志处理log类:lib/Think/Core/log.class.php  

//开启日志  

'LOG_RECORD'=>true,  

//日志处理log类:lib/Think/Core/log.class.php中有处理级别,可以选择性的加入  

'LOG_RECORD_LEVEL'=>array('EMERG','ALERT'),  

  

);  

?>  

 

在action中使用:

[php]  

          

//模型调试(数据库中执行的操作语句)  

$User=new Model('User');  

$User->find(1);  

//获取最后一次执行的sql  

echo $User->getLastSql();  

  

//使用:日志信息、日志级别、日志类型、具体信息  

Log::write("aa",$level,$type,$file);  

//record方法将信息写入到内存当中  

          

          

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1669
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
Detailed explanation of C++ function debugging: How to debug problems in multi-threaded functions? Detailed explanation of C++ function debugging: How to debug problems in multi-threaded functions? May 02, 2024 pm 04:15 PM

C++ multi-thread debugging can use GDB: 1. Enable debugging information compilation; 2. Set breakpoints; 3. Use infothreads to view threads; 4. Use thread to switch threads; 5. Use next, stepi, and locals to debug. Actual case debugging deadlock: 1. Use threadapplyallbt to print the stack; 2. Check the thread status; 3. Single-step the main thread; 4. Use condition variables to coordinate access to solve the deadlock.

How to use LeakSanitizer to debug C++ memory leaks? How to use LeakSanitizer to debug C++ memory leaks? Jun 02, 2024 pm 09:46 PM

How to use LeakSanitizer to debug C++ memory leaks? Install LeakSanitizer. Enable LeakSanitizer via compile flag. Run the application and analyze the LeakSanitizer report. Identify memory allocation types and allocation locations. Fix memory leaks and ensure all dynamically allocated memory is released.

How to conduct concurrency testing and debugging in Java concurrent programming? How to conduct concurrency testing and debugging in Java concurrent programming? May 09, 2024 am 09:33 AM

Concurrency testing and debugging Concurrency testing and debugging in Java concurrent programming are crucial and the following techniques are available: Concurrency testing: Unit testing: Isolate and test a single concurrent task. Integration testing: testing the interaction between multiple concurrent tasks. Load testing: Evaluate an application's performance and scalability under heavy load. Concurrency Debugging: Breakpoints: Pause thread execution and inspect variables or execute code. Logging: Record thread events and status. Stack trace: Identify the source of the exception. Visualization tools: Monitor thread activity and resource usage.

Shortcut to golang function debugging and analysis Shortcut to golang function debugging and analysis May 06, 2024 pm 10:42 PM

This article introduces shortcuts for Go function debugging and analysis, including: built-in debugger dlv, which is used to pause execution, check variables, and set breakpoints. Logging, use the log package to record messages and view them during debugging. The performance analysis tool pprof generates call graphs and analyzes performance, and uses gotoolpprof to analyze data. Practical case: Analyze memory leaks through pprof and generate a call graph to display the functions that cause leaks.

How to debug PHP asynchronous code How to debug PHP asynchronous code May 31, 2024 am 09:08 AM

Tools for debugging PHP asynchronous code include: Psalm: a static analysis tool that can find potential errors. ParallelLint: A tool that inspects asynchronous code and provides recommendations. Xdebug: An extension for debugging PHP applications by enabling a session and stepping through the code. Other tips include using logging, assertions, running code locally, and writing unit tests.

What are the debugging techniques for recursive calls in Java functions? What are the debugging techniques for recursive calls in Java functions? May 05, 2024 am 10:48 AM

The following techniques are available for debugging recursive functions: Check the stack traceSet debug pointsCheck if the base case is implemented correctlyCount the number of recursive callsVisualize the recursive stack

PHP Debugging Errors: A Guide to Common Mistakes PHP Debugging Errors: A Guide to Common Mistakes Jun 05, 2024 pm 03:18 PM

Common PHP debugging errors include: Syntax errors: Check the code syntax to make sure there are no errors. Undefined variable: Before using a variable, make sure it is initialized and assigned a value. Missing semicolons: Add semicolons to all code blocks. Function is undefined: Check that the function name is spelled correctly and make sure the correct file or PHP extension is loaded.

Tsinghua Optics AI appears in Nature! Physical neural network, backpropagation is no longer needed Tsinghua Optics AI appears in Nature! Physical neural network, backpropagation is no longer needed Aug 10, 2024 pm 10:15 PM

Using light to train neural networks, Tsinghua University results were recently published in Nature! What should I do if I cannot apply the backpropagation algorithm? They proposed a Fully Forward Mode (FFM) training method that directly performs the training process in the physical optical system, overcoming the limitations of traditional digital computer simulations. To put it simply, it used to be necessary to model the physical system in detail and then simulate these models on a computer to train the network. The FFM method eliminates the modeling process and allows the system to directly use experimental data for learning and optimization. This also means that training no longer needs to check each layer from back to front (backpropagation), but can directly update the parameters of the network from front to back. To use an analogy, like a puzzle, backpropagation

See all articles