Zfdebug zend framework debugging notes

Source: Internet
Author: User
Tags autoloader php and zend zend framework

1. Introduction to zfdbug:
Tests are everywhere during zend framework project development, but zend framework testing is very troublesome. Therefore, a foreigner wrote a zf debug plug-in with comprehensive functions (files, memory, data, cache, variables, runtime, and exceptions ), it can show the system information that we do not usually see, which is of great help for us to quickly locate problems and improve system performance and security.
With zfdebug, zend framework development projects will be used in the future, so there will be no troubles in debugging.


2. Official address of zfdebug:
Http://code.google.com/p/zfdebug/
Download address:
Http://code.google.com/p/zfdebug/downloads/list


Seo tutorial ver = "showmenu ({'ctrlid': this. id, 'pos': '13'})" style = "display: none; position: absolute">

Download(7.57 kb)



III. zfdebug installation method
The downloaded files cannot run directly. You can only copy several important files to your zf project and make some configuration.
Take zf1.10.0 as an example.
Copy zfdebuglibraryzfdebug to the library folder of your own zf project, for example, zfproject/library/zfdebug.
Open the file zfdebugdemoszend_application_bootstrap.php and copy all the protected function _ initzfdebug () code in it to your project.
In bootstrap. php.
In this way, you can see the zfdebug effect.
(Zfdebug images do not need to be copied because zfdebug has written zfdebug images as data streams for display)

4. Flexible use of zfdebug
However, pay attention to the following points during actual use,
1. By default, zfdebug only displays debugging information for three items. To display more debugging information types, modify
The bootstrap. php _ initzfdebug content of your project.
For example:
 

$ Autoloader = zend_loader_autoloader: getinstance ();
$ Autoloader-> registernamespace ('zfdebug ');
$ Db = zend_registry: get ('DB ');
$ Options = array (
'Ins ins' => array ('variables ',
'Database' => array ('adapter '=> $ db ),
'Html ',
'File' => array ('base _ path' => myweb_root_dir ),
'Memory ',
'Time ',
'Registry ',
'Exception '),
);


2. Debugging information should be used in the project development process and closed during actual use. Therefore, the zfdebug switch configuration should be added to the configuration file application. ini.
For example, zfdebug. open = 1
In _ initzfdebug (), you can determine whether to execute zfdebug based on this value.

3. By default, zfdebug uses the callback js file.
The solution is to modify the jquery_path variable of _ initzfdebug.
 

$ Options = array (
'Ins ins' => array ('variables ',
'Database' => array ('adapter '=> $ db ),
'Html ',
'File' => array ('base _ path' => myweb_root_dir ),
'Memory ',
'Time ',
'Registry ',
'Exception '),
'Jquery _ path' => "http: // lcoalhost/zfproject/templates/default/js/jquery. min. js"

);



4) It is also a js issue. In general, zfdebug works well, but in actual use, it is very likely that zfdebug's jquery. min. js conflicts with your project's js. It is indeed a headache.
The solution is to modify the core file of zfdebug so that the result of zfdebug is displayed in another window of iframe. This avoids js conflicts.

For more information about zfdebug, see the php files under libraryzfdebugcontrollerplugindebug. php and libraryzfdebugcontrollerplugindebugplugin. Then you will know the principles and modifications of zfdebug. The authors will also be amazed at their familiarity with the zf kernel.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.