本文整理汇总了PHP中Debug::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::add方法的具体用法?PHP Debug::add怎么用?PHP Debug::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: in
static function in($cat, $file, $debug = false)
{
// Looking for a potential error.
Debug::clear();
if (!$file) {
throw new \Exception("Looking for Empty File? (category = {$cat})");
}
if (!isset(self::$path[$cat])) {
throw new \Exception("Category {$cat} not found");
}
$path_list = self::$path[$cat];
foreach ($path_list as $path) {
$db = "Looking for: " . $path . $file;
Debug::add($path . DS . $file);
if ($debug) {
echo "Looking for: " . $path . $file . "<br/>";
}
if (file_exists($path . DS . $file)) {
if ($debug) {
echo "FOUND: " . $path . DS . $file . "<br/>";
}
return $path . DS . $file;
}
}
return false;
}
示例2: connect
/**
* 链接memcache,保存实例化的memcache
*/
private function connect()
{
if ($this->mem) {
return $this;
} else {
return $this->mem = memcache_connect($this->config['memcached_host'], $this->config['memcached_port']) or Debug::add('memcached连接失败');
}
}
示例3: connect
function connect()
{
$mysqli = mysqli_connect(Config::database('host') . ':' . Config::database('port'), Config::database('user'), Config::database('pass'), Config::database('name'));
if ($mysqli->connect_error) {
Debug::add('连接数据库失败:<font color=red>' . $mysqli->connect_error . '</font>');
exit('连接数据库失败:<font color=red>' . $mysqli->connect_error . '</font>');
} else {
$this->mysqli = $mysqli;
$this->exec('set names ' . Config::database('charset'));
return true;
}
}
示例4: flush
public static function flush($space = false)
{
if ($space == false) {
$space = self::$cache->config['default_space'];
}
$res = self::$cache->flush($space);
if ($res) {
Debug::add('缓存空间' . $space . '删除成功!', 0);
} else {
Debug::add('缓存空间' . $space . '删除失败!', 0);
}
return $res;
}
示例5: connect
function connect()
{
$con = @mysql_connect(Config::database('host') . ':' . Config::database('port'), Config::database('user'), Config::database('pass'));
if ($con) {
$r = mysql_select_db(Config::database('name'), $con) or Debug::add('连接数据库失败:<font color=red>' . mysql_error() . '</font>');
if ($r === true) {
$this->con = $con;
$this->exec('set names ' . Config::database('charset'));
return true;
}
} else {
Debug::add('连接Mysql服务器失败:,' . mysql_error());
}
return false;
}
示例6: connect
public function connect()
{
try {
$this->db = new pdo(config::database('DSN'), Config::database('user'), Config::database('pass'));
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
Debug::add('<font color="red">' . $e->getMessage() . '</font>');
}
if (!$this->db) {
return false;
} else {
$this->exec('set names ' . Config::database('charset'));
return true;
}
}
示例7: exit
<?php
if (!defined('__ROOT__')) {
exit('Sorry,Please from entry!');
}
/**
* init 入口引入文件
* 项目自动初始化文件
* 创建时间:2014-08-08 14:56 PGF
*/
Loader::core('Debug');
//加载DEBUG类
Debug::start();
//程序开始
Loader::func('Base');
//加载基础全局函数
Loader::core('Cache');
//加载缓存处理类
Cache::init();
//初始化缓存类
//向日志中添加已经加载的Loader
Debug::add(__ROOT__ . Config::config('core_dir') . '/bases/' . 'Loader.class.php', 1);
Loader::core('Router');
//加载Router
Router::run();
//Router运行
Debug::stop();
//程序结束
//==================== END Initialize.php ========================//
示例8: query
public final function query($sql = false)
{
if (!$sql) {
$this->compile();
}
$sql = $sql ? $sql : $this->sql;
//print_r($this);
//echo Config::database('table_pre').Config::cache('table');
if (Config::database('cache') && preg_match('/^SELECT/i', $sql) && (Config::database('table_pre') . Config::cache('table') != $this->table || Config::cache('driver') != 'dbCache')) {
//echo '开启缓存';
if (!Cache::is_cache(md5($sql), Config::database('cache_dir') . '/' . $this->section['table'])) {
$data = $this->_query($sql);
$cdata = '<?php exit;/*' . serialize($data) . '*/';
Cache::set(md5($sql), $cdata, Config::database('cache_dir') . '/' . $this->section['table']);
//Cache::$cache->writeCache($sql,$data,(Config::database('cache_dir').'/'.$this->section['table']));
Debug::add('DB:Update Cache ' . $sql, 2);
} else {
//$data=Cache::$cache->readCache($sql,(Config::database('cache_dir').'/'.$this->section['table']));
$data = unserialize(substr(Cache::get(md5($sql), Config::database('cache_dir') . '/' . $this->section['table']), 13, -2));
//exit();
Debug::add('DB:Read Cache' . $sql, 2);
}
$this->_reset();
if ($data == null) {
//防止直接返回Null
$data = array();
}
return $data;
} else {
Debug::add($sql, 2);
$this->_reset();
$data = $this->_query($sql);
if ($data == null) {
//防止直接返回Null
$data = array();
}
return $data;
}
}
示例9: returnData
if ($perfDataSize < 4) {
if ($perfDataSize == 1) {
returnData(Debug::errorMarkdownDashboard('#Influxdb Error: ' . $perfData[0] . ' Query: ' . INFLUX_QUERY), 1);
} else {
returnData(Debug::errorMarkdownDashboard('#Host / Service not found in Influxdb'), 1);
}
}
// load templates
$templates = Folder::loadFolders(array(CUSTOM_TEMPLATE_FOLDER, DEFAULT_TEMPLATE_FOLDER));
Rule::setCheck($perfData['host'], $perfData['service'], $perfData['command'], array_keys($perfData['perfLabel']));
usort($templates, 'Template::compare');
$valid = $templates[0]->isValid();
foreach ($templates as $template) {
Debug::add($template);
}
Debug::add("Is the first template valid: " . Debug::printBoolean($valid));
if ($valid) {
$template = $templates[0];
} else {
$template = Template::findDefaultTemplate($templates, 'default.php');
}
if (isset($template) && !empty($template)) {
returnData($template->getTemplate($perfData), 0, 'OK');
} else {
returnData(Debug::errorMarkdownDashboard('#No template found!'), 1);
}
/**
This function will print its input and exit with the given returncode.
@param object $data This object will be converted to json.
@param int $returnCode The returncode the programm will exit.
@return null.
示例10: product_index
public function product_index($p_product_id)
{
Debug::add("LimeLight->product_index()");
if (is_array($p_product_id)) {
$productCsv = implode(",", $p_product_id);
} else {
$productCsv = $p_product_id;
}
$qty_prods = count($p_product_id);
Debug::add(array("product_id" => $productCsv));
$result = $this->api('product_index', array("product_id" => $productCsv));
if (!empty($result)) {
foreach ($result as $field_name => $field_val) {
$field_name = urldecode($field_name);
$field_val = explode(',', $field_val);
if (count($field_val) >= $qty_prods) {
for ($j = 0; $j < $qty_prods; $j++) {
if ($field_name == 'response_code') {
$res_arr[$p_product_id[$j]][$field_name] = urldecode($field_val[$j]);
$res_arr[$p_product_id[$j]]['product_id'] = $p_product_id[$j];
} else {
// The response_code is always first in the result from LimeLight so it should
// exist. If they change the order of their first field then this will break!
if ($res_arr[$p_product_id[$j]]['response_code'] == '100') {
// Only record product information on valid product results.
$res_arr[$p_product_id[$j]][$field_name] = urldecode($field_val[$j]);
}
}
}
}
}
}
// temp hack
Debug::add("Overriding product data with our product data - start");
// we need to override/add product data from our own data to fill in missing fields such as quantity
if (is_array($res_arr)) {
foreach ($res_arr as $productId => $product) {
$data = ProductLL::getProduct($productId);
if (is_array($data)) {
$res_arr[$productId] += $data;
}
}
}
Debug::add("Overriding product data with our product data - end");
Debug::add($res_arr);
return $res_arr;
}
示例11: load
public static function load($file)
{
if (file_exists($file)) {
$re = (require $file);
Debug::add($file, '1');
return $re;
}
Debug::add('Loader:' . $file . ' not found.');
return false;
}
示例12: catchError
public static function catchError($errno, $errstr, $errfile, $errline)
{
Debug::add(new ErrorException($errstr, 0, $errno, $errfile, $errline));
}
示例13: queryError
/**
* Handles an Query Error: A QueryExcpetion will be thrown.
*
* @see QueryException
* @throws QueryException
* @param string Last Query
**/
protected function queryError($query)
{
$e = new QueryException($this->error(), $this->errno());
$e->setQuery($query);
$e->setLine(__LINE__);
$e->setFile(__FILE__);
// Try to get better results for line and file.
if (function_exists('debug_backtrace') == true) {
$backtraceInfo = debug_backtrace();
// 0 is class.mysql.php, 1 is the calling code...
if (isset($backtraceInfo[1]) == true) {
$e->setLine($backtraceInfo[1]['line']);
$e->setFile($backtraceInfo[1]['file']);
}
}
$this->debug->add($e);
throw $e;
}
示例14: __call
public function __call($a, $b)
{
Debug::add("方法{$a}不存在!");
}