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


PHP printArray函数代码示例

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


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

示例1: printArray

function printArray($array, $title = null)
{
    if ($title != null) {
        echo "<h1>" . $title . "</h1>";
    }
    //fill table header
    if (empty($array)) {
        echo "No contents";
    } else {
        echo "<table border=1><tr>";
        foreach ($array[0] as $key => $value) {
            echo "<th>" . $key . "</th>";
        }
        echo "</tr>";
        foreach ($array as $item) {
            echo "<tr>";
            foreach ($item as $key => $value) {
                echo "<td>";
                if (is_array($value)) {
                    printArray($value);
                } elseif ($key == "Data") {
                    echo date('d/m/Y', strtotime($value));
                } else {
                    echo $value;
                }
                echo "</td>";
            }
            echo "</tr>";
        }
        echo "</table>";
    }
}
开发者ID:vascofg,项目名称:sinf,代码行数:32,代码来源:globals.php

示例2: getPath

 /**
  * Get path of this route
  * @since Version 3.9
  * @return array
  */
 public function getPath()
 {
     $params = array("mode" => 0, "line" => $this->route_id);
     $stops = $this->fetch("stops-for-line", $params);
     printArray($this->url);
     printArray($stops);
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:12,代码来源:Route.php

示例3: send

 /**
  * @param null $host - $host of socket server
  * @param null $port - port of socket server
  * @param string $action - action to execute in sockt server
  * @param null $data - message to socket server
  * @param string $address - addres of socket.io on socket server
  * @param string $transport - transport type
  * @return bool
  */
 public function send($action = "message", $data = null, $address = "socket.io/?EIO=2", $transport = 'websocket')
 {
     $fd = fsockopen($this->hostname, $this->port, $errno, $errstr);
     if (!$fd) {
         throw new Exception("Could not establish connection to " . $this->hostname . ":" . $this->port);
     }
     $key = $this->generateKey();
     $out = "GET {$address}&transport={$transport} HTTP/1.1\r\n";
     $out .= "Host: http://{$host}:{$port}\r\n";
     $out .= "Upgrade: WebSocket\r\n";
     $out .= "Connection: Upgrade\r\n";
     $out .= "Sec-WebSocket-Key: {$key}\r\n";
     $out .= "Sec-WebSocket-Version: 13\r\n";
     $out .= "Origin: *\r\n\r\n";
     fwrite($fd, $out);
     // 101 switching protocols, see if echoes key
     $result = fread($fd, 10000);
     preg_match('#Sec-WebSocket-Accept:\\s(.*)$#mU', $result, $matches);
     printArray($result);
     $keyAccept = trim($matches[1]);
     $expectedResonse = base64_encode(pack('H*', sha1($key . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11')));
     $handshaked = $keyAccept === $expectedResonse ? true : false;
     if ($handshaked) {
         fwrite($fd, $this->hybi10Encode('42["' . $action . '", "' . addslashes($data) . '"]'));
         fread($fd, 1000000);
         return true;
     } else {
         return false;
     }
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:39,代码来源:SocketIO.php

示例4: getContent

 function getContent()
 {
     $s = "<div>";
     $s .= printArray($this);
     $s .= "</div>";
     return $s;
 }
开发者ID:mobiskif,项目名称:VKonverte_PHP,代码行数:7,代码来源:classVisible.php

示例5: printAny

function printAny($text)
{
    if (is_array($text)) {
        printArray($text);
    } else {
        printText($text);
    }
}
开发者ID:the-tool,项目名称:the-tool,代码行数:8,代码来源:index.blade.php

示例6: __construct

 /**
  * Constructor
  * @since Version 3.2
  * @var object $db
  * @var object $User
  */
 public function __construct($User = false)
 {
     parent::__construct();
     if (!$User || !$User->id || $User->id == NULL || empty($User->id)) {
         throw new \Exception("Cannot instantiate " . __CLASS__ . " - user object is empty or not loaded" . printArray(debug_backtrace()));
     }
     $this->User = $User;
 }
开发者ID:doctorjbeam,项目名称:railpagecore,代码行数:14,代码来源:User.php

示例7: sortArrarTest

function sortArrarTest()
{
    $number = array(10, 2, 10, 88, 7, 7, 3);
    sort($number);
    printArray($number);
    rsort($number);
    printArray($number);
}
开发者ID:xuefengyang,项目名称:PhpFirst,代码行数:8,代码来源:index.php

示例8: printArray

function printArray($array)
{
    foreach ($array as $key => $value) {
        echo "{$key} => {$value}";
        if (is_array($value)) {
            //If $value is an array, print it as well!
            printArray($value);
        }
    }
}
开发者ID:vipak,项目名称:mashproject.github.io,代码行数:10,代码来源:subscribe.php

示例9: printArray

/**
 * Определить рекурсивную функцию - аналог функции print_r
 */
function printArray(array &$arr)
{
    if (key($arr) === null) {
        reset($arr);
        return 0;
    } else {
        echo '[' . key($arr) . ']' . ' => ' . current($arr) . '</br>';
        next($arr);
        printArray($arr);
    }
    reset($arr);
    return 0;
}
开发者ID:selentsov,项目名称:homeworks,代码行数:16,代码来源:71.php

示例10: init

function init()
{
    if (isset($_SESSION["user"])) {
        return;
    }
    $tk = C('tk');
    echo $tk;
    if (empty($tk)) {
        return false;
    }
    printArray($_SESSION["user"]);
    $user = new Users();
    $auth = $user->AuthAuto($tk);
}
开发者ID:cloverink,项目名称:lotto,代码行数:14,代码来源:auth.php

示例11: printArray

function printArray($array, $spaces = "")
{
    $retValue = "";
    if (is_array($array)) {
        $spaces = $spaces . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $retValue = $retValue . "<br/>";
        foreach (array_keys($array) as $key) {
            $retValue = $retValue . $spaces . "<strong>" . $key . "</strong>" . printArray($array[$key], $spaces);
        }
        $spaces = substr($spaces, 0, -30);
    } else {
        $retValue = $retValue . " - " . $array . "<br/>";
    }
    return $retValue;
}
开发者ID:nsystem1,项目名称:ZeeJong,代码行数:15,代码来源:newWiki.php

示例12: show

 function show()
 {
     header('Content-Type: text/html; charset=utf-8');
     if ($this->context->state->zakaz->debug) {
         //if (TRUE) {
         //echo $this->getContent();
         echo '<style> .active {font-weight: bold;} </style>';
         $this->include_();
         echo "<hr/>" . printArray($this);
     } else {
         include TEMPL . '/header.html';
         $this->include_();
         include TEMPL . '/footer.html';
     }
 }
开发者ID:mobiskif,项目名称:VKonverte_PHP,代码行数:15,代码来源:View.php

示例13: echoBookList

/**
 * Echo the list of videos in the specified feed.
 *
 * @param Zend_Gdata_Books_BookFeed $feed The video feed
 * @return void
 */
function echoBookList($feed)
{
    print <<<HTML
    <table><tr><td id="resultcell">
    <div id="searchResults">
        <table class="volumeList"><tbody width="100%">
HTML;
    $flipflop = false;
    foreach ($feed as $entry) {
        $title = printArray($entry->getTitles());
        $volumeId = $entry->getVolumeId();
        if ($thumbnailLink = $entry->getThumbnailLink()) {
            $thumbnail = $thumbnailLink->href;
        } else {
            $thumbnail = null;
        }
        $preview = $entry->getPreviewLink()->href;
        $embeddability = $entry->getEmbeddability()->getValue();
        $creators = printArray($entry->getCreators());
        if (!empty($creators)) {
            $creators = "by " . $creators;
        }
        if ($embeddability == "http://schemas.google.com/books/2008#embeddable") {
            $preview_link = '<a href="javascript:load_viewport(\'' . $preview . '\',\'viewport\');">' . '<img class="previewbutton" src="http://code.google.com/' . 'apis/books/images/gbs_preview_button1.png" />' . '</a><br>';
        } else {
            $preview_link = '';
        }
        $thumbnail_img = !$thumbnail ? '' : '<a href="' . $preview . '"><img src="' . $thumbnail . '"/></a>';
        print <<<HTML
        <tr>
        <td><div class="thumbnail">
            {$thumbnail_img}
        </div></td>
        <td width="100%">
            <a href="{$preview}">{$title}</a><br>
            {$creators}<br>
            {$preview_link}
        </td></tr>
HTML;
    }
    print <<<HTML
    </table></div></td>
        <td width=50% id="previewcell"><div id="viewport"></div>&nbsp;
    </td></tr></table><br></body></html>
HTML;
}
开发者ID:natureday1,项目名称:Life,代码行数:52,代码来源:index.php

示例14: SuggestEvents

 /**
  * Suggest events to tag
  * @since Version 3.10.0
  * @param \Railpage\Images\Image $imageObject
  * @return array
  */
 public static function SuggestEvents(Image $imageObject)
 {
     if (!$imageObject->DateCaptured instanceof DateTime) {
         return;
     }
     $Database = (new AppCore())->getDatabaseConnection();
     $query = "SELECT COUNT(*) AS num FROM image_link WHERE namespace = ? AND image_id = ?";
     $params = [(new Event())->namespace, $imageObject->id];
     if ($Database->fetchOne($query, $params) > 0) {
         return;
     }
     $Events = new Events();
     $list = $Events->getEventsForDate($imageObject->DateCaptured);
     foreach ($list as $k => $row) {
         $Event = new Event($row['event_id']);
         printArray($Event->namespace);
         die;
         $list[$k]['url'] = sprintf("/services?method=railpage.image.tag&image_id=%d&object=%s&object_id=%d", $imageObject->id, "\\Railpage\\Events\\Event", $row['event_id']);
     }
     return $list;
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:27,代码来源:Tagger.php

示例15: printArray

function printArray($arr)
{
    if (!is_object($arr) and !is_array($arr)) {
        return $arr;
    } else {
        if (is_object($arr)) {
            $s = "Object: " . get_class($arr) . "<ul>";
            foreach (get_object_vars($arr) as $key => $value) {
                $s .= "<li>" . $key . " = " . printArray($value) . "</li>";
            }
            $s .= "</ul>";
            return $s;
        } else {
            $s = "Array: <ul>";
            foreach ($arr as $key => $value) {
                $s .= "<li>" . $key . " = " . printArray($value) . "</li>";
            }
            $s .= "</ul>";
            return $s;
        }
    }
}
开发者ID:mobiskif,项目名称:VKonverte_PHP,代码行数:22,代码来源:include.php


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