• 数据表结构如下:
    | category | CREATE TABLE category (
    id int(11) NOT NULL DEFAULT '0',
    pid int(11) DEFAULT NULL,
    title varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
    name varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
    PRIMARY KEY (id)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci





Log in to reply



  • S

    You can use

    <?php { AddLog("anypage.php","reason",ERR_ERROR); } ?>

    or if you want to print that statement in an log you can use

    AddLog("anypage.php","string: ".$string,ERR_DEBUG_LOW);

    read more
  • S

    You can use:

    <?php echo '<script>console.log("debug log")</script>'; ?>

    read more
  • S

    I use cakephp so I use:

    $this->log(YOUR_STRING_GOES_HERE, 'debug');

    read more
  • S

    I have used many of these, but since I usually need to debug when developing, and since I develop on localhost, I have followed the advice of others and now write to the browser's JavaScript debug console (see

    That means that I can look at the web page which my PHP is generating in my browser & press F12 to quickly show/hide any debug trace.

    Since I am constantly looking at the developer tools for debugger, CSS layout, etc, it makes sense to look at my PHP loggon there.

    If anyone does decide to us that code, I made one minor change. After

    function debug($name, $var = null, $type = LOG) {

    I added

    $name = 'PHP: ' . $name;

    This is because my server side PHP generates HTML conatining JavaScript & I find it useful to distinguish between output from PHP & JS.

    (Note: I am currently updating this to allow me to switch on & off different output types: from PHP, from JS, and database access)

    read more
  • S

    This a great tool for debugging & logging php: PHp Debugger & Logger

    It works right out of the box with just 3 lines of code. It can send messages to the js console for ajax debugging and can replace the error handler. It also dumps information about variables like var_dump() and print_r(), but in a more readable format. Very nice tool!

    read more