當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Common::getRandomString方法代碼示例

本文整理匯總了PHP中Piwik\Common::getRandomString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Common::getRandomString方法的具體用法?PHP Common::getRandomString怎麽用?PHP Common::getRandomString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\Common的用法示例。


在下文中一共展示了Common::getRandomString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: write

 protected function write(array $record)
 {
     switch ($record['level']) {
         case Logger::EMERGENCY:
         case Logger::ALERT:
         case Logger::CRITICAL:
         case Logger::ERROR:
             $context = Notification::CONTEXT_ERROR;
             break;
         case Logger::WARNING:
             $context = Notification::CONTEXT_WARNING;
             break;
         default:
             $context = Notification::CONTEXT_INFO;
             break;
     }
     $message = $record['level_name'] . ': ' . htmlentities($record['message']);
     $notification = new Notification($message);
     $notification->context = $context;
     $notification->flags = 0;
     try {
         Manager::notify(Common::getRandomString(), $notification);
     } catch (Zend_Session_Exception $e) {
         // Can happen if this handler is enabled in CLI
         // Silently ignore the error.
     }
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:27,代碼來源:WebNotificationHandler.php

示例2: PiwikTracker

<?php

// Script that creates 100 websites, then outputs a IMG that records a pageview in each website
// Used initially to test how to handle cookies for this use case (see http://dev.piwik.org/trac/ticket/409)
use Piwik\Common;
use Piwik\FrontController;
use Piwik\Piwik;
use Piwik\Plugins\SitesManager\API;
exit;
define('PIWIK_INCLUDE_PATH', '../..');
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
require_once PIWIK_INCLUDE_PATH . "/libs/PiwikTracker/PiwikTracker.php";
FrontController::getInstance()->init();
Piwik::setUserHasSuperUserAccess();
$count = 100;
for ($i = 0; $i <= $count; $i++) {
    $id = API::getInstance()->addSite(Common::getRandomString(), 'http://piwik.org');
    $t = new PiwikTracker($id, 'http://localhost/trunk/piwik.php');
    echo $id . " <img width=100 height=10 border=1 src='" . $t->getUrlTrackPageView('title') . "'><br/>";
}
開發者ID:kreynen,項目名稱:elmsln,代碼行數:24,代碼來源:test_cookies_GenerateHundredsWebsitesAndVisits.php


注:本文中的Piwik\Common::getRandomString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。