之前一直用firephp来调试php,主要受限Firefox启动太慢,研究了下chromephp;

写了个简单的判断模版:

 <?php
/**
* @Author: Klaus
* @Date: 2016-01-16 10:23:44
* @Last Modified by: Administrator
* @Last Modified time: 2016-01-27 11:28:35
*/
// 判断当前浏览器
if (strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome')) {
$browser = 'Chrome';
} else if (strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox / 3')) {
$browser = 'Firefox';
} else if (strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox / 2')) {
$browser = 'Firefox';
} else {
$browser = $_SERVER["HTTP_USER_AGENT"];
} // 定义是否测试 1 测试,0线上
$debug = 1; // 不同浏览器引入不同文件
if ($debug == 1) {
if ($browser == 'Chrome') {
require 'ChromePhp.php';
function fb($a, $b = '')
{
if ($b) {
return ChromePhp::log($b . ":", $a);
} else {
return ChromePhp::log($a);
}
}
$chrome = "ChromePhp.php开启了!";
fb($chrome);
} else {
require 'FirePHPCore/fb.php';
$a = "firephp开启了!";
fb($a, "php调试");
}
} else {
function fb($a, $b = '')
{
}
}

其中自动判断浏览器,网上找的哈!

后续主要优化fb()函数,firefox的fb()函数习惯了,cheomephp造了个fb()函数,这样,chrome、firefox都支持了;

测试效果如下:

Chrome:

Firefox:

其中插件方面 Chrome  :Chrome Logger 用的时候需要点击下插件按钮开启,这个没有firephp方便;

Chromephp下载:https://github.com/ccampbell/chromephp

打包链接:http://files.cnblogs.com/files/pthlp/ChromeLogger.zip

希望大家多多提提意见哈!

类似FirePhp的Chrome.php 调试php的更多相关文章

  1. WebView 与PC机Chrome配合调试

    参考自http://www.cnblogs.com/terrylin/p/4606277.html 移动端WebView开发调试:Chrome远程调试 Chrome DevTools调试移动设备Bro ...

  2. 安卓手机移动端Web开发调试之Chrome远程调试(Remote Debugging)

    一.让安卓打debug模式的apk包 二.将电脑中的chrome升级到最新版本,在chrome浏览器地址栏中输入chrome://inspect/#devices: 在智能手机还未普及时,移动设备的调 ...

  3. Node.js在Chrome进行调试

    在开发node.js环境时候,调试是一件很疼苦的事情,不过随着时代不断发展,先如今已经有很多种node环境代码调试方式,今天我就笔记一下我使用的方式 node-inspector: node-insp ...

  4. 在chrome 总调试cordova出现Detached from the target. Remote debugging has been terminated with reason: Connection lost. Please re-attach to the new target

    在chrome 总调试cordova出现如下错误: "Detached from the target. Remote debugging has been terminated with ...

  5. chrome远程调试真机上的app - 只显示空白页面

    chrome远程调试真机上的app - 只显示空白页面 这个是chrome需要的插件没办法自动下载导致的,怎么办你懂得,越狱... 调试起来感觉卡顿的厉害哇,有没有更好的方式?

  6. chrome远程调试真机上的app

    chrome远程调试真机上的app 看来要上真机了...

  7. chrome断点调试

    chrome断点调试 在编写JavaScript代码时,如果出现了bug,就要不断的去找错误,如果console控制台中提示还好说,可是没有提示恐怕就要费一番周折了.但是有了chrome这个浏览器,我 ...

  8. 在 Chrome 中调试 Android 浏览器

    最近需要使用 Chrome Developer Tools 调试 Android 浏览器,但是官方指南并不是很好使,经过一番折腾,终于调试成功了,在此把经验分享给需要的朋友. Chrome Devel ...

  9. Google Chrome浏览器调试入门————转载只为自己查看方便

    Google Chrome浏览器调试 作为Web开发人员,我为什么喜欢Google Chrome浏览器 [原文地址:http://www.cnblogs.com/QLeelulu/archive/20 ...

随机推荐

  1. Helpers\Pagination

    Helpers\Pagination Break recordset into a series of pages. First create a new instance of the class ...

  2. c语言例子递归与整数逆序

    例一 #include <stdio.h> //将一整数逆序后放入一数组中(要求递归实现) void convert(int *result, int n) { if(n>=10) ...

  3. [Java] HashMap、TreeMap、Hashtable排序

    Java中对Map(HashMap,TreeMap,Hashtable等)的排序时间 首先简单说一下他们之间的区别: HashMap: 最常用的Map,它根据键的HashCode 值存储数据,根据键可 ...

  4. Python Virtualenv 虚拟环境

    在python2和python3共存的机器上做开发,要想互不干扰,虚拟环境很重要. Debian7 默认是python2.7.3,装好python3.4.1后怎么建立虚拟环境呢? $ pyvenv m ...

  5. Android之ListView常用技巧

    ListView是一个非常常用的列表控件,虽然在5.x时代ListView的风头正在逐渐的被RecyclerView抢去,但是ListView的使用范围依然十分广泛. 接下来的ListView的常用技 ...

  6. [改善Java代码]适时选择不同的线程池来实现

    Java的线程池实现从最根本上来说只有两个:ThreadPoolExecutor类和ScheduledThreadPoolExecutor类,这两个类还是父子关系,但是Java为了简化并行计算,还提供 ...

  7. Servlet & JSP - UrlRewriteFilter

    重写 URL 的好处有很多: 静态化页面,有利于搜索引擎收录. 隐藏真实的 URL,提高安全性. 当网站的结构发生变化时,无需要求用户修改书签. UrlRewriteFilter 的简单应用 1. M ...

  8. java开发:分享一下MemCached的使用

    在项目开发中,有些不经常修改的数据,我们通常都会选择使用缓存.其中一种方式,就是memcached. windows系统中,我们需要下载并安装memcached. 地址如:D:\memcached\m ...

  9. 如何将 select top 4 id from table1 赋值 给 declare @id1 int,@id2 int,@id3 int,@id4 int

    declare @id1 int,@id2 int,@id3 int,@id4 int ),) select @sickcode = sickcode,@sfrq =sfrq from tablena ...

  10. iOS - 文件与数据(File & Data)

    01 推出系统前的时间处理 --- 实现监听和处理程序退出事件的功能 //视图已经加载过时调用 - (void)viewDidLoad { [super viewDidLoad]; // Do any ...