当前位置: 首页>>代码示例>>PHP>>正文


PHP echo_r函数代码示例

本文整理汇总了PHP中echo_r函数的典型用法代码示例。如果您正苦于以下问题:PHP echo_r函数的具体用法?PHP echo_r怎么用?PHP echo_r使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了echo_r函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: channel_msg_ship

function channel_msg_ship($fp, $rdata)
{
    global $channel;
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!ship\\s(.*)\\s$/i', $rdata, $msg)) {
        echo_r($msg);
        $db = new SmrMySqlDatabase();
        $db->query('SELECT * FROM ship_type WHERE ship_name LIKE ' . $db->escape_string('%' . $msg[4] . '%'));
        if ($db->nextRecord()) {
            $ship_name = $db->getField('ship_name');
            $hardpoint = $db->getField('hardpoint');
            $speed = $db->getField('speed');
            $cost = $db->getField('cost');
            $name_length = strlen($ship_name);
            $hp_length = strlen('Hardpoints');
            $speed_length = strlen('Speed');
            $cost_length = max(strlen('Costs'), strlen($cost));
            fputs($fp, 'NOTICE ' . $msg[1] . ' :' . str_pad('Name', $name_length) . ' | ' . str_pad('Hardpoints', $hp_length) . ' | ' . str_pad('Speed', $speed_length) . ' | ' . str_pad('Costs', $cost_length) . EOL);
            fputs($fp, 'NOTICE ' . $msg[1] . ' :' . str_pad($ship_name, $name_length) . ' | ' . str_pad($hardpoint, $hp_length) . ' | ' . str_pad($speed, $speed_length) . ' | ' . str_pad($cost, $cost_length) . EOL);
        } else {
            fputs($fp, 'NOTICE ' . $msg[1] . ' :There is no ship called ' . $msg[4] . '!' . EOL);
        }
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:25,代码来源:ship.php

示例2: channel_msg_sd_list

function channel_msg_sd_list($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!sd list\\s$/i', $rdata, $msg)) {
        global $sds;
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[SD_LIST] by ' . $nick . ' in ' . $channel);
        $refresh_per_hour = 250 * Globals::getGameSpeed($player->getGameID());
        $refresh_per_sec = $refresh_per_hour / 3600;
        fputs($fp, 'PRIVMSG ' . $channel . ' :The following supply/demand list has been recorded:' . EOL);
        fputs($fp, 'PRIVMSG ' . $channel . ' :Sector   Amount' . EOL);
        foreach ($sds as $sd) {
            if ($sd[3] == $channel) {
                $seconds_since_refresh = time() - $sd[2];
                if ($seconds_since_refresh < 0) {
                    $seconds_since_refresh = 0;
                }
                $amt_to_add = floor($seconds_since_refresh * $refresh_per_sec);
                if ($sd[1] + $amt_to_add > 4000) {
                    fputs($fp, 'PRIVMSG ' . $channel . ' : ' . sprintf('%4s', $sd[0]) . '     ' . sprintf('%4s', 'full') . EOL);
                } else {
                    fputs($fp, 'PRIVMSG ' . $channel . ' : ' . sprintf('%4s', $sd[0]) . '     ' . sprintf('%4s', $sd[1] + $amt_to_add) . EOL);
                }
            }
        }
        return true;
    }
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:30,代码来源:channel_msg_sd.php

示例3: postEdit

 public function postEdit($p, $z)
 {
     $data = json_decode($_POST['filterData'])->subs[0];
     echo_r($data);
     echo_r(sqlify($data));
     die;
 }
开发者ID:rgigger,项目名称:zoopframework,代码行数:7,代码来源:ZoneFilter.php

示例4: check_events

function check_events($fp)
{
    global $events;
    foreach ($events as $key => $event) {
        if ($event[0] < time()) {
            echo_r('[TIMER] finished. Sending a note to ' . $event[2]);
            fputs($fp, 'NOTICE ' . $event[2] . ' :' . $event[1] . EOL);
            unset($events[$key]);
        }
    }
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:11,代码来源:maintenance.php

示例5: smarty_function_echo_r

function smarty_function_echo_r($params, &$smarty)
{
    if (is_null($params['var'])) {
        echo 'NULL';
        return;
    }
    if (!isset($params['var'])) {
        trigger_error("assign: missing 'var' parameter");
        return;
    }
    echo_r($params['var']);
}
开发者ID:rgigger,项目名称:zinc,代码行数:12,代码来源:function.echo_r.php

示例6: query_command

function query_command($fp, $rdata)
{
    // :MrSpock!mrspock@coldfront-120CBD34.dip.t-dialin.net PRIVMSG Caretaker :Test
    if (preg_match('/^:(MrSpock!mrspock|Page!Page)@.*\\sPRIVMSG\\s' . IRC_BOT_NICK . '\\s:(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $text = $msg[2];
        echo_r('[QUERY] by ' . $nick . ': ' . $text);
        // relay msg as our own
        fputs($fp, $text . EOL);
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:13,代码来源:query.php

示例7: ____

/**
 * A powerfull debugging function based on die() and var_dump or print_r PHP-defined functions
 * @param mixed $var
 * @return void
 */
function ____($var, $dump = TRUE, $exit = TRUE)
{
    echo '<pre style="font-size: 1.3em; color: #FF0000; line-height: 18px;">';
    if (!$dump) {
        echo_r($var);
    } else {
        var_dump($var);
    }
    echo '</pre>';
    if ($exit) {
        exit;
    }
}
开发者ID:pokaxperia,项目名称:emus-itdp,代码行数:18,代码来源:debugging.php

示例8: handleTextNode

 function handleTextNode($node, $container, $styleStack)
 {
     $textRun = $container->getNewTextRun();
     echo_r($node->getTextContent());
     $textRun->setTextInfo($node->getTextContent());
     // echo $textRun;
     $textRun->setStyle($styleStack->getTopStyle());
     // echo 'handleTextNode<br>';
     // $this->container->drawRenderTree();
     // echo_r($container);
     // echo_r($node->getTextContent());
     // echo_r($extra);
     // die();
 }
开发者ID:laiello,项目名称:zoop,代码行数:14,代码来源:GraphicParser.php

示例9: channel_action_slap

function channel_action_slap($fp, $rdata)
{
    // :MrSpock!mrspock@coldfront-25B201B9.dip.t-dialin.net PRIVMSG #rod : ACTION slaps Caretaker around a bit with a large trout
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:.ACTION slaps ' . IRC_BOT_NICK . '/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[SLAP] by ' . $nick . ' in ' . $channel);
        $slap_responses = array('blocks ' . $nick . '\'s attack and beats six shades of shit out of their pets', 'drops dead on the ground', 'ducks and takes aim with an M16', 'throws rocks at ' . $nick, 'beats ' . $nick . ' like a red-headed step child', 'gets up off the ground and roundhouse kicks ' . $nick . ' in the face', 'does an evasive backflip and throws ninja stars at ' . $nick, 'slaps ' . $nick . ' around a bit with a large trout', 'deflects the slap and deals ' . rand(1, 999999) . ' damage to ' . $nick, 'steals the trout and throws it back in the river');
        fputs($fp, 'PRIVMSG ' . $channel . ' :' . chr(1) . 'ACTION ' . $slap_responses[rand(0, count($slap_responses) - 1)] . chr(1) . EOL);
        return true;
    }
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:14,代码来源:channel_action.php

示例10: ctcp_ping

function ctcp_ping($fp, $rdata)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:' . chr(1) . 'PING\\s(.*)' . chr(1) . '\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $botnick = $msg[4];
        $their_time = $msg[5];
        echo_r('[CTCP_PING] by ' . $nick . ' at ' . $their_time);
        fputs($fp, 'NOTICE ' . $nick . ' :' . chr(1) . 'PING ' . time() . chr(1) . EOL);
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:14,代码来源:ctcp.php

示例11: invite

function invite($fp, $rdata)
{
    // :MrSpock!mrspock@coldfront-425DB813.dip.t-dialin.net INVITE Caretaker :#fe
    if (preg_match('/^:(.*)!(.*)@(.*) INVITE ' . IRC_BOT_NICK . ' :(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[INVITE] by ' . $nick . ' for ' . $channel);
        // join channel where they want us
        fputs($fp, 'JOIN ' . $channel . EOL);
        sleep(1);
        fputs($fp, 'WHO ' . $channel . EOL);
    }
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:15,代码来源:invite.php

示例12: assignHeaders

 public function assignHeaders()
 {
     $headers = $this->getHeaders();
     echo_r($headers);
     if (isset($headers['publish-date'])) {
         $this->published_date = $headers['publish-date'];
     }
     if (isset($headers['title'])) {
         $this->title = $headers['title'];
     }
     if (isset($headers['link'])) {
         $this->link = $headers['link'];
     }
     if (isset($headers['link-text'])) {
         $this->link_text = $headers['link-text'];
     }
     echo_r($this);
 }
开发者ID:laiello,项目名称:zoop,代码行数:18,代码来源:Entry.php

示例13: channel_msg_rank

function channel_msg_rank($fp, $rdata)
{
    global $channel, $nick;
    // did he gave us no parameter?
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!rank\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:rank\\s$/i', $rdata, $msg)) {
        echo_r($msg);
        fputs($fp, 'NOTICE ' . $msg[1] . ' :SYNTAX !rank <nick>' . EOL);
        return true;
    }
    // in channel we only accept !rank
    // in private msg we accept both
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!rank\\s(.*)\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:?rank\\s(.*)\\s$/i', $rdata, $msg)) {
        echo_r($msg);
        $db = new SmrMySqlDatabase();
        $db2 = new SmrMySqlDatabase();
        $db->query('SELECT * FROM player WHERE player_name = ' . $db->escape_string($msg[4], true));
        if ($db->getNumRows()) {
            while ($db->nextRecord()) {
                $player_name = stripslashes($db->getField('player_name'));
                $experience = $db->getField('experience');
                $game_id = $db->getField('game_id');
                $db2->query('SELECT COUNT(*) as our_rank FROM player ' . 'WHERE game_id = ' . $game_id . ' AND ' . '(experience > ' . $experience . ' OR ' . '(experience = ' . $experience . ' AND ' . 'player_name <= ' . $db->escape_string($player_name, true) . ' ))');
                if ($db2->nextRecord()) {
                    $our_rank = $db2->getField('our_rank');
                }
                // how many players are there?
                $db2->query('SELECT COUNT(*) as total_player FROM player WHERE game_id = ' . $game_id);
                if ($db2->nextRecord()) {
                    $total_player = $db2->getField('total_player');
                }
                $db2->query('SELECT game_name FROM game WHERE game_id = ' . $game_id);
                if ($db2->nextRecord()) {
                    $game_name = $db2->getField('game_name');
                }
                fputs($fp, 'NOTICE ' . $msg[1] . ' :' . $msg[1] . ' you are ranked ' . $our_rank . ' out of ' . $total_player . ' in ' . $game_name . '!' . EOL);
            }
        } else {
            fputs($fp, 'NOTICE ' . $msg[1] . ' :No Trader found that matches your query!' . EOL);
        }
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:43,代码来源:rank.php

示例14: channel_msg_level

function channel_msg_level($fp, $rdata)
{
    global $channel, $nick;
    // in channel we only accept !rank
    // in private msg we accept both
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!level\\s(.*)\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:?level\\s(.*)\\s$/i', $rdata, $msg)) {
        echo_r($msg);
        $db = new SmrMySqlDatabase();
        $db->query('SELECT * FROM level WHERE level_id = ' . $msg[4]);
        if ($db->nextRecord()) {
            $level_name = $db->getField('level_name');
            $experience = $db->getField('requirement');
            fputs($fp, 'NOTICE ' . $msg[1] . ' :For a ' . $level_name . ' you need to have ' . $experience . ' experience points!' . EOL);
        } else {
            fputs($fp, 'NOTICE ' . $msg[1] . ' :This Level doesn\'t exist!!' . EOL);
        }
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:20,代码来源:level.php

示例15: notice_nickserv_unknown_user

function notice_nickserv_unknown_user($fp, $rdata)
{
    // :NickServ!services@coldfront.net NOTICE Caretaker :Nickname Slevin isn't registered.
    if (preg_match('/^:NickServ!services@coldfront.net NOTICE ' . IRC_BOT_NICK . ' :Nickname .(.*). isn\'t registered\\.\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        echo_r('[NOTICE_NICKSERV_UNKNOWN_NICK] ' . $nick);
        global $actions;
        foreach ($actions as $key => $action) {
            // is that a callback for our nick?
            if ($action[0] == 'NICKSERV_INFO' && $nick == $action[2]) {
                echo_r('Callback found: ' . $action[3]);
                unset($actions[$key]);
                if ($action[5] === true) {
                    fputs($fp, 'PRIVMSG ' . $action[1] . ' :' . $nick . ', you are not using a registered nick. Please identify with NICKSERV and try the last command again.' . EOL);
                }
            }
        }
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:21,代码来源:notice.php


注:本文中的echo_r函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。