本文整理汇总了PHP中spError函数的典型用法代码示例。如果您正苦于以下问题:PHP spError函数的具体用法?PHP spError怎么用?PHP spError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 构造函数
* @param dbConfig 数据库配置
*/
public function __construct($dbConfig)
{
if (!function_exists('sqlite_open')) {
spError('PHP环境未安装Sqlite函数库!');
}
$linkfunction = TRUE == $dbConfig['persistent'] ? 'sqlite_popen' : 'sqlite_open';
if (!($this->conn = $linkfunction($dbConfig['host'], 0666, $sqliteerror))) {
spError('数据库链接错误/无法找到数据库 : ' . $sqliteerror);
}
}
示例2: __construct
/**
* 构造函数
* @param dbConfig 数据库配置
*/
public function __construct($dbConfig)
{
if (TRUE == SP_DEBUG) {
sae_set_display_errors(TRUE);
}
$this->conn = new SaeMysql();
if ($this->conn->errno()) {
spError("数据库链接错误 : " . $this->conn->error());
}
$this->conn->setCharset("UTF8");
}
示例3: display
/**
* 显示模板
* @param tplname 模板名称
*/
public function display($tplname)
{
if (file_exists(realpath($this->template_dir) . '/' . $tplname)) {
$tplpath = realpath($this->template_dir) . '/' . $tplname;
} elseif (file_exists($tplname)) {
$tplpath = $tplname;
} else {
spError("speedy引擎:无法找到模板 " . $tplname);
}
extract($this->_vars);
if (TRUE == $this->enable_gzip) {
global $__speedy_compression_level;
$__speedy_compression_level = $this->compression_level;
ob_start('speedy_ob_gzip');
}
include $tplpath;
}
示例4: __construct
/**
* 构造函数
*
* @param dbConfig 数据库配置
*/
public function __construct($dbConfig)
{
if (!function_exists('oci_connect')) {
spError('PHP环境未安装ORACLE函数库!');
}
$linkfunction = TRUE == $dbConfig['persistent'] ? 'oci_pconnect' : 'oci_connect';
if (!($this->conn = $linkfunction($dbConfig['login'], $dbConfig['password'], $dbConfig['host'], 'AL32UTF8'))) {
$e = oci_error();
spError('数据库链接错误 : ' . strip_tags($e['message']));
}
}
示例5: __construct
public function __construct()
{
if (!function_exists('xcache_set')) {
spError('PHP环境未安装Xcache函数库!');
}
}
示例6: define
/**
* spCore
*
* SpeedPHP应用框架的系统执行程序
*/
// 定义系统路径
if (!defined('SP_PATH')) {
define('SP_PATH', dirname(__FILE__) . '/SpeedPHP');
}
if (!defined('APP_PATH')) {
define('APP_PATH', dirname(__FILE__) . '/app');
}
// 载入核心函数库
require SP_PATH . "/spFunctions.php";
if (substr(PHP_VERSION, 0, 1) != '5') {
spError("SpeedPHP框架环境要求PHP5!");
}
// 载入配置文件
$GLOBALS['G_SP'] = spConfigReady(require SP_PATH . "/spConfig.php", $spConfig);
// 根据配置文件进行一些全局变量的定义
if ('debug' == $GLOBALS['G_SP']['mode']) {
define("SP_DEBUG", TRUE);
// 当前正在调试模式下
} else {
define("SP_DEBUG", FALSE);
// 当前正在部署模式下
}
// 如果是调试模式,打开警告输出
if (SP_DEBUG) {
if (substr(PHP_VERSION, 0, 3) == "5.3") {
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
示例7: __construct
/**
* 构造函数
*
* @param dbConfig 数据库配置
*/
public function __construct($dbConfig)
{
if (!function_exists('mssql_connect')) {
spError('PHP环境未安装MSSQL函数库!');
}
$linkfunction = TRUE == $dbConfig['persistent'] ? 'mssql_pconnect' : 'mssql_connect';
$this->conn = $linkfunction($dbConfig['host'], $dbConfig['login'], $dbConfig['password']) or spError("数据库链接错误 : " . mssql_get_last_message());
mssql_select_db($dbConfig['database'], $this->conn) or spError("无法找到数据库,请确认数据库名称正确!");
}
示例8: define
/**
* spCore
*
* SpeedPHP应用框架的系统执行程序
*/
// 定义系统路径
if (!defined('SP_PATH')) {
define('SP_PATH', dirname(__FILE__));
}
if (!defined('APP_PATH')) {
define('APP_PATH', dirname(dirname(__FILE__)));
}
// 载入核心函数库
require SP_PATH . '/spFunctions.php';
if (substr(PHP_VERSION, 0, 1) != '5') {
spError('SpeedPHP框架环境要求PHP5!');
}
// 载入配置文件
$GLOBALS['G_SP'] = spConfigReady(require SP_PATH . '/spConfig.php', $spConfig);
// 设置错误处理函数
//set_error_handler('spErrorHandler');
@set_magic_quotes_runtime(0);
// 载入核心MVC架构文件
import($GLOBALS['G_SP']['sp_core_path'] . '/spController.php', FALSE, TRUE);
import($GLOBALS['G_SP']['sp_core_path'] . '/spModel.php', FALSE, TRUE);
import($GLOBALS['G_SP']['sp_core_path'] . '/spView.php', FALSE, TRUE);
// 当在二级目录中使用SpeedPHP框架时,自动获取当前访问的文件名
if ('' == $GLOBALS['G_SP']['url']['url_path_base']) {
if (basename($_SERVER['SCRIPT_NAME']) === basename($_SERVER['SCRIPT_FILENAME'])) {
$GLOBALS['G_SP']['url']['url_path_base'] = $_SERVER['SCRIPT_NAME'];
} elseif (basename($_SERVER['PHP_SELF']) === basename($_SERVER['SCRIPT_FILENAME'])) {
示例9: error
function error($message, $tplname)
{
spError($message . $tplname);
}
示例10: spErrorHandler
/**
* spErrorHandler 系统错误提示函数
* @param errno 出错类型
* @param errstr 错误信息
* @param errfile 出错的文件
* @param errline 出错语句行号
*/
function spErrorHandler($errno, $errstr, $errfile, $errline)
{
if (E_ERROR == $errno || E_PARSE == $errno) {
spError($errstr);
}
}
示例11: __construct
/**
* 构造函数
*
* @param dbConfig 数据库配置
*/
public function __construct($dbConfig)
{
$linkfunction = TRUE == $dbConfig['persistent'] ? 'mysql_pconnect' : 'mysql_connect';
$this->conn = $linkfunction($dbConfig['host'] . ":" . $dbConfig['port'], $dbConfig['login'], $dbConfig['password']) or spError("数据库链接错误 : " . mysql_error());
mysql_select_db($dbConfig['database'], $this->conn) or spError("无法找到数据库,请确认数据库名称正确!");
$this->exec("SET NAMES UTF8");
}
示例12: getTableInfo
private function getTableInfo($table)
{
mysql_select_db($this->database, $this->conn) or spError("无法链接数据库或者没有" . $this->database . "数据库访问权限。");
$sql = "select * from `{$this->database}`.`{$table}` WHERE 1";
$rs = $this->getArray($sql);
//获取crate sql
if (is_array($rs)) {
$filed = $val = '';
//处理字段
foreach ($rs[0] as $k => $v) {
$filed .= '`' . $k . '` ,';
}
$filed = substr($filed, 0, -1);
//去掉多余的逗号
foreach ($rs as $d) {
$vas = '';
foreach ($d as $va) {
if (is_numeric($va)) {
$vas .= $va . ',';
} else {
$vas .= "'" . addslashes($va) . "',";
}
}
$vas = substr($vas, 0, -1);
$val .= '(' . $vas . "),{$this->ln}";
}
$sql = "{$this->ln}{$this->ln}INSERT INTO `{$table}` ";
$sql .= "( {$filed} ) VALUES {$this->ln} {$val}";
$sql = substr($sql, 0, -2) . ';';
return $sql . $this->ln . $this->ln;
} else {
return $this->ln . $this->ln;
}
}
示例13: __construct
/**
* 构造函数
* @param dbConfig 数据库配置
*/
public function __construct($dbConfig)
{
if (!function_exists('oci_connect')) {
spError('PHP环境未安装ORACLE函数库!');
}
$linkfunction = TRUE == $dbConfig['persistent'] ? 'oci_pconnect' : 'oci_connect';
if (!($this->conn = $linkfunction($dbConfig['login'], $dbConfig['password'], $dbConfig['host'], 'AL32UTF8'))) {
$e = oci_error();
spError('数据库链接错误 : ' . strip_tags($e['message']));
}
$this->exec('ALTER SESSION SET NLS_DATE_FORMAT = \'yyyy-mm-dd hh24:mi:ss\'');
}
示例14: forumline
public function forumline($user_id)
{
if ($this->forum_open) {
$num_per_page = 4;
$args = array("page" => 2);
$uc_id = $this->spArgs('ucid');
if ($user_id) {
$conditions['user_id'] = $user_id;
$args['uid'] = $user_id;
if (!$uc_id) {
$ptx_user = spClass("ptx_user");
$user = $ptx_user->getuser_byid($user_id);
$uc_id = $user['uc_id'];
}
}
if (!$uc_id || !is_numeric($uc_id)) {
spError(T('no_bbs_account_bind'));
return;
}
$args['ucid'] = $uc_id;
$conditions['authorid'] = $uc_id;
$next_time = $this->spArgs("next_time");
$this->need_static = false;
if ($next_time) {
$now = $next_time;
} else {
$now = time();
$this->need_static = $this->page == 1 ? true : false;
}
$forum_post = spClass('forum_post');
$conditions['lt_time'] = $now;
$last_post = $forum_post->find_one($conditions, " forum_post.dateline DESC ", " forum_post.pid,forum_post.dateline ");
$last_time = $last_post['dateline'];
$last_post_month = (int) date('m', $last_time);
$last_post_month_days = (int) date('t', $last_time);
$last_post_year = (int) date('Y', $last_time);
$this_month_time_first = time(0, 0, 0, $last_post_month, 1, $last_post_year);
$this_month_time_last = time(24, 59, 59, $last_post_month, $last_post_month_days, $last_post_year);
$conditions['gt_time'] = $this_month_time_first;
$conditions['lt_time'] = $this_month_time_last;
$this_month_last_post = $forum_post->find_one($conditions, " forum_post.dateline DESC ", " forum_post.pid,forum_post.dateline ");
$posts = $forum_post->search($conditions, $this->page, $num_per_page, NULL, " forum_post.dateline DESC ");
if (array_length($posts) == $num_per_page) {
$next_search_time = $posts[$num_per_page - 1]['dateline'];
//$this->resetPage = true;
} else {
$next_search_time = $this_month_time_first;
$this->resetPage = true;
}
if ($this_month_last_post['pid'] == $posts[0]['pid']) {
$this->timeline_date = $last_post_year . '年' . $last_post_month . '月';
}
$forum_attachment = spClass('forum_attachment');
foreach ($posts as $key => $post) {
$posts[$key]['images'] = $forum_attachment->search_attach_images($post['pid']);
$post['message'] = messageclean($post['message']);
$post['message'] = tpl_modifier_bbcode2html($post['message']);
$posts[$key]['message'] = $post['message'];
}
$args['next_time'] = $next_search_time;
$this->nextpage_url = spUrl($this->current_controller, $this->current_action, $args);
$this->forumlineView($posts, 'post');
//$this->set_user_banner($user_id);
$this->output("user/forumline");
}
}
示例15: __construct
/**
* 构造函数
*
* @param dbConfig 数据库配置
*/
public function __construct($dbConfig)
{
if (!class_exists("PDO")) {
spError('PHP环境未安装PDO函数库!');
}
try {
$this->conn = new PDO($dbConfig['host'], $dbConfig['login'], $dbConfig['password']);
} catch (PDOException $e) {
echo '数据库链接错误/无法找到数据库 : ' . $e->getMessage();
}
}