本文整理匯總了PHP中debug::error方法的典型用法代碼示例。如果您正苦於以下問題:PHP debug::error方法的具體用法?PHP debug::error怎麽用?PHP debug::error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類debug
的用法示例。
在下文中一共展示了debug::error方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: select
function select()
{
$args = func_get_args() ? implode(',', func_get_args()) : false;
$select = $this->read($args);
$select or debug::error('沒有查詢到數據', 116002);
return $select->fetchAll(PDO::FETCH_ASSOC);
}
示例2: buildModel
static function buildModel($model)
{
$modelFile = _APP_ . 'core/model/' . $model . '.php';
$modelBase = _APP_ . 'model/' . $model . '.model.php';
if (file_exists($modelBase)) {
if (file_exists($modelFile) || filemtime($modelBase) > filemtime($modelFile)) {
include _APP_ . 'model/' . $model . '.model.php';
$fields = array_combine(str_replace('@', C('DB_FIX'), array_keys($fields)), array_values($fields));
$links = array_combine(str_replace('@', C('DB_FIX'), array_keys($links)), str_replace('@', C('DB_FIX'), array_values($links)));
//在數據中解析出表名
$tables = array();
foreach (array_keys($fields) as $v) {
array_push($tables, array_shift(explode('.', $v)));
}
$tables = array_unique($tables);
//獲取關聯關係
$arr = array();
foreach ($links as $k => $v) {
array_push($arr, $k . '=' . $v);
}
$links = $arr;
$table['tables'] = $tables;
$table['fields'] = $fields;
$table['links'] = $links;
file_put_contents($modelFile, "<?php\nreturn " . var_export($table, true) . "\n?>");
}
} else {
file_exists($modelFile) and unlink($modelFile);
debug::error('模型' . $model . '文件不存在.', 11004);
}
}
示例3: output
function output()
{
//set all template variables
foreach ($this->vars as $var => $val) {
${$var} = $val;
}
if ($this->parent_view) {
foreach ($this->parent_view->vars as $var => $val) {
${$var} = $val;
}
}
// TODO: Check extract() for an alternative method
$path = Kennel::cascade("{$this->view}", 'views');
if (!$path) {
return debug::error("View <strong>{$this->view}</strong> not found.");
}
//begin intercepting the output buffer
ob_start();
if ($path) {
require $path;
}
//return the output and close the buffer
return ob_get_clean();
//unset all template variables
foreach ($this->vars as $var => $val) {
unset(${$var});
}
}
示例4: __construct
function __construct($image)
{
if (is_string($image)) {
if (!is_file($image)) {
return debug::error("Image <strong>{$image}</strong> not found at");
}
$this->path = pathinfo($image);
$imageSize = getimagesize($image);
$this->width = $imageSize[0];
$this->height = $imageSize[1];
$this->mime = $imageSize['mime'];
switch ($this->mime) {
case 'image/jpeg':
$this->image = imagecreatefromjpeg($image);
break;
case 'image/png':
$this->image = imagecreatefrompng($image);
break;
case 'image/gif':
$this->image = imagecreatefromgif($image);
break;
}
} else {
$this->width = imagesx($image);
$this->height = imagesy($image);
$this->image = $image;
}
}
示例5: _empty
function _empty($fun)
{
if (file_exists(_APP_ . 'template/' . C('TEMPLATE_STYLE') . '/' . $_GET['m'] . '/' . $_GET['a'] . '.' . C('TEMPLATE_SUFFIX'))) {
$this->display();
} else {
debug::error('沒有找到該操作!', 20202);
}
}
示例6: getInstance
function getInstance()
{
if (self::$INSTANCE) {
return self::$INSTANCE;
} else {
return debug::error('Template::getInstance() error: there is no instance created yet');
}
}
示例7: autoload
/**
* Autoload function
* Whenever an unknown class/function is invoked, this function is called to include correct file(s)
* Outputs an error if resource not found
*
* @param String $class class or function name to invoke
* @return void
*/
function autoload($class)
{
if ($class == "smarty" || !preg_match("#smarty#i", $class)) {
if (file_exists(PLUGIN . '/' . $class . '/plugin.' . $class . '.php')) {
require_once PLUGIN . '/' . $class . '/plugin.' . $class . '.php';
} elseif (file_exists(PLUGIN . '/' . strtolower($class) . '/plugin.' . strtolower($class) . '.php')) {
require_once PLUGIN . '/' . strtolower($class) . '/plugin.' . strtolower($class) . '.php';
} elseif (file_exists(SYSTEM . '/class/class.' . $class . '.php')) {
require_once SYSTEM . '/class/class.' . $class . '.php';
} else {
debug::error("Plugin autoload", "Plugin could not be loaded", PLUGIN . '/' . $class . '/plugin.' . $class . '.php');
}
}
}
示例8: file
static function file($uri)
{
# Absolute paths
if (substr($uri, 0, 7) === 'http://') {
return $uri;
}
# Cascading Resource
$path = Kennel::cascade($uri, 'file', true);
if ($path) {
return $path;
} else {
debug::error("assets helper: File <b>{$uri}</b> not found.", 1);
}
}
示例9: show
function show()
{
if (file_exists($this->templateFile)) {
//開發模式下記錄模板
C('DEVE') and debug::$info['templaceFile'] = $this->templateFile;
if (file_exists($this->cacheFile) && filemtime($this->cacheFile) > filemtime($this->templateFile)) {
include $this->cacheFile;
} else {
$this->cache();
include $this->cacheFile;
}
} else {
debug::error('模版不存在:' . $this->templateFile, 202001);
}
}
示例10: __construct
function __construct($data, $num = 5)
{
if (isset($_GET['page'])) {
$_GET['page'] == 1 and header("Location: {$_SERVER['SCRIPT_NAME']}/{$_GET['m']}/{$_GET['a']}");
$this->thisPage = intval($_GET['page']);
} else {
$this->thisPage = 1;
}
$this->data = $data;
$this->num = $num;
$this->pageNum = $this->getPageNum();
if ($this->thisPage != 1) {
if ($this->thisPage < 1 or $this->thisPage > $this->pageNum) {
debug::error('沒有找到分頁!', 219001);
}
}
$this->offset = $this->getOffset();
$this->pageHtml();
}
示例11: __construct
function __construct($model_name)
{
if (!$model_name) {
debug::error("Schema::__construct - undefined model name.");
}
$path = Kennel::cascade($model_name, 'schemas');
if (!$path) {
debug::error("Schema::__construct - model schema for \"{$model_name}\" not found.");
}
$doc = new DOMDocument();
$doc->load(realpath($path));
$root = $doc->getElementsByTagName('model')->item(0);
if (Kennel::getSetting('database', 'prefix')) {
$this->table = Kennel::getSetting('database', 'prefix') . '_' . $root->getAttribute('table');
} else {
$this->table = $root->getAttribute('table');
}
$fields = $doc->getElementsByTagName('field');
foreach ($fields as $field) {
$this->fields[] = new Field($this->table, $field);
}
}
示例12: getSaveQuery
function getSaveQuery($forceInsert = false)
{
$primaryKey = $this->schema->getPrimaryKey();
$columns = array();
$newValues = array();
$syncedValues = array();
// Add quotes for non-numeric field values, used to the SQL statement
foreach ($this->schema as $field) {
$columns[] = '`' . $field->name . '`';
switch (strtolower($field->type)) {
case 'varchar':
case 'char':
case 'text':
case 'datetime':
case 'date':
case 'time':
if ($this->_data[$field->name] !== NULL) {
$newValues[] = '"' . MySQL::escape_string($this->_data[$field->name]) . '"';
} else {
$newValues[] = 'NULL';
}
if ($this->_synced_data[$field->name] !== NULL) {
$syncedValues[] = '"' . MySQL::escape_string($this->_synced_data[$field->name]) . '"';
} else {
$syncedValues[] = 'NULL';
}
break;
case 'int':
case 'tinyint':
case 'bigint':
case 'float':
case 'double':
case 'decimal':
if ($this->_data[$field->name] !== NULL && is_numeric($this->_data[$field->name])) {
$newValues[] = $this->_data[$field->name];
} else {
$newValues[] = 'NULL';
}
if ($this->_synced_data[$field->name] !== NULL && is_numeric($this->sunced_data[$field->name])) {
$syncedValues[] = $this->_synced_data[$field->name];
} else {
$syncedValues[] = 'NULL';
}
break;
default:
debug::error("Model::save - Unsuported field type \"{$field->type}\" for field \"{$field->name}\" on model \"{$this->model_name}\"");
}
}
// Check if it's an existing record, build SQL statement accordingly
if (!$this->_synced_data[$primaryKey->name] || $forceInsert) {
$sql = "INSERT INTO {$this->schema->table} (";
$sql .= implode(', ', $columns);
$sql .= ")\nVALUES (";
$sql .= implode(', ', $newValues);
$sql .= ");";
} else {
$dataList = array();
foreach ($columns as $key => $column) {
$dataList[] = "\n {$column} = {$newValues[$key]}";
}
$c = new Criteria($this->model_name);
foreach ($this->schema as $field) {
$c->add($field->name, $this->_synced_data[$field->name]);
}
$sql = "UPDATE {$this->schema->table} SET " . implode(', ', $dataList);
$sql .= "\nWHERE " . ORM::getWhereString($c) . ';';
}
return $sql;
}
示例13: error
/**
* Creates a node before a given node
* <pre>
* +-- root1
* |
* +-\ root2
* | |
* | |-- subnode2 [new]
* | |-- subnode1 [target]
* | |-- subnode3
* |
* +-- root3
* </pre>
*
* @param int $id Target node ID
* @param array $values Hash with param => value pairs of the node (see $this->_params)
* @param bool $returnID Tell the method to return a node id instead of an object.
* ATTENTION: That the method defaults to return an object instead of the node id
* has been overseen and is basically a bug. We have to keep this to maintain BC.
* You will have to set $returnID to true to make it behave like the other creation methods.
* This flaw will get fixed with the next major version.
* @access public
* @return mixed The node id or false on error
*/
function create_left_node($id, $values)
{
$this->_verify_user_values($values);
// invalid target node, bail out
if (!($this_node = $this->get_node($id)))
{
debug :: error(TREE_ERROR_NODE_NOT_FOUND,
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array('id' => $id)
);
return false;
}
// If the target node is a rootnode we virtually want to create a new root node
if ($this_node['root_id'] == $this_node['id'])
{
return $this->create_root_node($values, $id, false, NESE_MOVE_BEFORE);
}
$insert_data = array();
$parent = $this->get_parent($id);
$insert_data['parent_id'] = $parent['id'];
$sql = array();
$sql[] = sprintf('UPDATE %s SET ordr=ordr+1
WHERE root_id=%s AND ordr>=%s AND level=%s AND l BETWEEN %s AND %s',
$this->_node_table,
$this_node['root_id'],
$this_node['ordr'],
$this_node['level'],
$parent['l'], $parent['r']);
// Update all nodes which have dependent left and right values
$sql[] = sprintf('UPDATE %s SET
l=CASE WHEN l >= %s THEN l+2 ELSE l END,
r=CASE WHEN (r >= %s OR l >= %s) THEN r+2 ELSE r END
WHERE root_id=%s',
$this->_node_table,
$this_node['l'],
$this_node['r'],
$this_node['l'],
$this_node['root_id']);
$insert_data['ordr'] = $this_node['ordr'];
$insert_data['l'] = $this_node['l'];
$insert_data['r'] = $this_node['l'] + 1;
$insert_data['root_id'] = $this_node['root_id'];
$insert_data['level'] = $this_node['level'];
if (!$this->_dumb_mode || !$node_id = isset($values['id']))
{
$node_id = $insert_data['id'] = $this->_db->get_max_column_value($this->_node_table, 'id') + 1;
}
else
{
$node_id = $values['id'];
}
if (!$qr = $this->_values2insert_query($values, $insert_data))
{
return false;
}
// Insert the new node
$sql[] = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->_node_table, implode(', ', array_keys($qr)), implode(', ', $qr));
foreach ($sql as $qry)
{
$this->_db->sql_exec($qry);
}
return $node_id;
}
示例14: __autoload
deve::load(_FFPHP_ . 'source/core/view.class.php');
}
//加載核心文件
deve::load(array(_FFPHP_ . 'source/core/ffphp.class.php', _FFPHP_ . 'source/core/compile.class.php', _FFPHP_ . 'source/core/action.class.php'));
//檢測數據連接類型
if (C('CONNECT_TYPE') == 1) {
deve::load(_FFPHP_ . 'source/drive/mysqli.class.php');
} else {
deve::load(_FFPHP_ . 'source/drive/pdo.class.php');
}
//URL路由
ffphp::pathUrl();
//類的自動加載
function __autoload($className)
{
deve::load(_APP_ . 'behavior/' . $className . '.class.php');
}
//控製器的格式化創建
$actionfile = _APP_ . 'action/' . strtolower($_GET['m']) . '.class.php';
if (file_exists($actionfile)) {
deve::buildAction($_GET['m']);
$newAction = strtolower($_GET['m']) . 'Action';
deve::load(_APP_ . 'core/action/' . $newAction . '.class.php');
$action = new $newAction();
$action->{$_GET}['a']();
} else {
debug::error('控製器不存在!', 202102);
}
if (C('DEBUG')) {
debug::$showed or debug::show();
}
示例15: descTable
protected function descTable()
{
$table = array();
$tableInfo = $this->mysqli->query('desc ' . $this->tableName);
$tableInfo or debug::error('數據表不存在!', 113006);
while ($arr = $tableInfo->fetch_assoc()) {
if (is_int(stripos($arr['Type'], 'int'))) {
$FieldType = 'i';
} elseif (is_int(stripos($arr['Type'], 'float')) || is_int(stripos($arr['Type'], 'double'))) {
$FieldType = 'd';
} elseif (is_int(stripos($arr['Type'], 'blob'))) {
$FieldType = 'b';
} else {
$FieldType = 's';
}
$table['list'][$arr['Field']] = $FieldType;
if ($arr['Key'] == 'PRI') {
$table['pri'] = $arr['Field'];
}
}
empty($table['pri']) and $table['pri'] = $table['list'][0];
$this->tableInfo = $table;
return $table;
}