本文整理汇总了PHP中Piwik\Db::fetchAssoc方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::fetchAssoc方法的具体用法?PHP Db::fetchAssoc怎么用?PHP Db::fetchAssoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Db
的用法示例。
在下文中一共展示了Db::fetchAssoc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContentNames
protected function getContentNames($websiteId = null, $date = null)
{
if (!is_null($websiteId)) {
return \Piwik\API\Request::processRequest('Contents.getContentNames', array('idSite' => $websiteId, 'period' => 'year', 'date' => $date));
}
return Db::fetchAssoc("select `idaction`, `name` from `{$this->tablePrefix}log_action` where `type` = ?", array(\Piwik\Tracker\Action::TYPE_CONTENT_NAME));
}
示例2: getDBStatus
/**
* Gets general database info that is not specific to any table.
*
* @throws Exception
* @return array See http://dev.mysql.com/doc/refman/5.1/en/show-status.html .
*/
public function getDBStatus()
{
if (function_exists('mysql_connect')) {
$configDb = Config::getInstance()->database;
$link = mysql_connect($configDb['host'], $configDb['username'], $configDb['password']);
$status = mysql_stat($link);
mysql_close($link);
$status = explode(" ", $status);
} else {
$fullStatus = Db::fetchAssoc('SHOW STATUS');
if (empty($fullStatus)) {
throw new Exception('Error, SHOW STATUS failed');
}
$status = array('Uptime' => $fullStatus['Uptime']['Value'], 'Threads' => $fullStatus['Threads_running']['Value'], 'Questions' => $fullStatus['Questions']['Value'], 'Slow queries' => $fullStatus['Slow_queries']['Value'], 'Flush tables' => $fullStatus['Flush_commands']['Value'], 'Open tables' => $fullStatus['Open_tables']['Value'], 'Opens' => 'unavailable', 'Queries per second avg' => 'unavailable');
}
return $status;
}