<?
define('ABC_CRITICAL', 0);
define('ABC_ERROR', 1);
define('ABC_ALERT', 2);
define('ABC_WARNING', 3);
define('ABC_NOTICE', 4);
define('ABC_INFO', 5);
define('ABC_DEBUG', 6);
define('ABC_TRACE', 7);
define('ABC_VAR_DUMP', 8);
define('ABC_NO_LOG', -1);
$php_version = split( "\.", phpversion() );
if( $php_version[0] == 4 && $php_version[1] <= 1 ) {
if( !function_exists('var_export') ) {
function var_export( $exp, $ret ) {
ob_start();
var_dump( $exp );
$result = ob_get_contents();
ob_end_clean();
return $result;
}}}function print_bt()
{
print "<code>\n";
$cs = debug_backtrace();
for( $i = 1; $i < count($cs) ; $i++ )
{
$item = $cs[ $i ];
for( $j = 0; $j < count($item['args']); $j++ )
if( is_string($item['args'][$j]) )
$item['args'][$j] = "\"" . $item['args'][$j] . "\"";
$args = join(",", $item['args'] );
if( isset( $item['class'] ) )
$str = sprintf("%s(%d): %s%s%s(%s)",
$item['file'],
$item['line'],
$item['class'],
$item['type'],
$item['function'],
$args );
else
$str = sprintf("%s(%d): %s(%s)",
$item['file'],
$item['line'],
$item['function'],
$args );
echo $str . "<br>\n";
}print "</code>\n";
}function _die( $str )
{
print "Script died with reason: $str<br>\n";
print_bt();
exit();
}class DebugOut
{
var $priorities = array(ABC_CRITICAL => 'critical',
ABC_ERROR => 'error',
ABC_ALERT => 'alert',
ABC_WARNING => 'warning',
ABC_NOTICE => 'notice',
ABC_INFO => 'info',
ABC_DEBUG => 'debug',
ABC_TRACE => 'trace',
ABC_VAR_DUMP => 'dump'
);
var $_ready = false;
var $_currentPriority = ABC_DEBUG;
var $_consumers = array();
var $_filename;
var $_fp;
var $_logger_name;
function DebugOut($name, $logger_name, $level ){
$this->_filename = $name;
$this->_currentPriority = $level;
$this->_logger_name = $logger_name;
if ($level > ABC_NO_LOG){
$this->_openfile();
} /*Destructor Registering*/
register_shutdown_function(array($this,"close"));
} function log($message, $priority = ABC_INFO) {
// Abort early if the priority is above the maximum logging level.
if ($priority > $this->_currentPriority) {
return false;
} // Add to loglines array
return $this->_writeLine($message, $priority, strftime('%b %d %H:%M:%S'));
} function dump($variable,$name) {
$priority = ABC_VAR_DUMP;
if ($priority > $this->_currentPriority ) {
return false;
} $time = strftime('%b %d %H:%M:%S');
$message = var_export($variable,true);
return fwrite($this->_fp,
sprintf("%s %s [%s] variable %s = %s \r\n",
$time,
$this->_logger_name,
$this->priorities[$priority],
$name,
$message)
);
} function info($message) {
return $this->log($message, ABC_INFO);
} function debug($message) {
return $this->log($message, ABC_DEBUG);
} function notice($message) {
return $this->log($message, ABC_NOTICE);
} function warning($message) {
return $this->log($message, ABC_WARNING);
} function trace($message) {
return $this->log($message, ABC_TRACE);
} function error($message) {
return $this->log($message, ABC_ERROR);
} /**
* Writes a line to the logfile
*
* @param string $line The line to write
* @param integer $priority The priority of this line/msg
* @return integer Number of bytes written or -1 on error
* @access private
*/
function _writeLine($message, $priority, $time) {
if( fwrite($this->_fp, sprintf("%s %s [%s] %s\r\n", $time, $this->_logger_name, $this->priorities[$priority], $message)) ) {
return fflush($this->_fp);
} else {
return false;
} } function _openfile() {
if (($this->_fp = @fopen($this->_filename, 'a')) == false) {
return false;
} return true;
} function close(){
if($this->_currentPriority != ABC_NO_LOG){
$this->info("Logger stoped");
return fclose($this->_fp);
} } /*
* Managerial Functions.
*
*/
function Factory($name, $logger_name, $level) {
$instance = new DebugOut($name, $logger_name, $level);
return $instance;
} function &getWriterSingleton($name, $logger_name, $level = ABC_DEBUG){
static $instances;
if (!isset($instances)){
$instances = array();
} $signature = serialize(array($name, $level));
if (!isset($instances[$signature])) {
$instances[$signature] = DebugOut::Factory($name, $logger_name, $level);
}
return $instances[$signature];
} function attach(&$logObserver) {
if (!is_object($logObserver)) {
return false;
} $logObserver->_listenerID = uniqid(rand());
$this->_listeners[$logObserver->_listenerID] = &$logObserver;
}}define ('ABC_BAD_DATE', -1);
class ExcelDateUtil{
/*
* return 1900 Date as integer TIMESTAMP.
* for UNIX date must be
*
*/
function xls2tstamp($date) {
$date=$date>25568?$date:25569;
/*There was a bug if Converting date before 1-1-1970 (tstamp 0)*/
$ofs=(70 * 365 + 17+2) * 86400;
return ($date * 86400) - $ofs;
}function getDateArray($xls_date){
$ret = array();
// leap year bug
if ($xls_date == 60) {
$ret['day'] = 29;
$ret['month'] = 2;
$ret['year'] = 1900;
return $ret;
} else if ($xls_date < 60) {
// 29-02-1900 bug
$xls_date++;
} // Modified Julian to DMY calculation with an addition of 2415019
$l = $xls_date + 68569 + 2415019;
$n = (int)(( 4 * $l ) / 146097);
$l = $l - (int)(( 146097 * $n + 3 ) / 4);
$i = (int)(( 4000 * ( $l + 1 ) ) / 1461001);
$l = $l - (int)(( 1461 * $i ) / 4) + 31;
$j = (int)(( 80 * $l ) / 2447);
$ret['day'] = $l - (int)(( 2447 * $j ) / 80);
$l = (int)($j / 11);
$ret['month'] = $j + 2 - ( 12 * $l );
$ret['year'] = 100 * ( $n - 49 ) + $i + $l;
return $ret;
}function isInternalDateFormat($format) {
$retval =false;
switch(format) {
// Internal Date Formats as described on page 427 in
// Microsoft Excel Dev's Kit...
case 0x0e:
case 0x0f:
case 0x10:
case 0x11:
case 0x12:
case 0x13:
case 0x14:
case 0x15:
case 0x16:
case 0x2d:
case 0x2e:
case 0x2f:
// Additional internal date formats found by inspection
// Using Excel v.X 10.1.0 (Mac)
case 0xa4:
case 0xa5:
case 0xa6:
case 0xa7:
case 0xa8:
case 0xa9:
case 0xaa:
case 0xab:
case 0xac:
case 0xad:
$retval = true; break;
default: $retval = false; break;
} return $retval;
}}define('EXCEL_FONT_RID',0x31);
define('XF_SCRIPT_NONE',0);
define('XF_SCRIPT_SUPERSCRIPT',1);
define('XF_SCRIPT_SUBSCRIPT',2);
define('XF_UNDERLINE_NONE',0x0);
define('XF_UNDERLINE_SINGLE',0x1);
define('XF_UNDERLINE_DOUBLE',0x2);
define('XF_UNDERLINE_SINGLE_ACCOUNTING',0x3);
define('XF_UNDERLINE_DOUBLE_ACCOUNTING',0x4);
define('XF_STYLE_ITALIC', 0x2);
define('XF_STYLE_STRIKEOUT', 0x8);
define('XF_BOLDNESS_REGULAR',0x190);
define('XF_BOLDNESS_BOLD',0x2BC);
class ExcelFont {
function basicFontRecord() {
return array('size' => 10,
'script' => XF_SCRIPT_NONE,
'undeline' => XF
php实现excle数据导入mysql数据库
4星 · 超过85%的资源 需积分: 50 139 浏览量
2010-12-29
10:43:13
上传
评论 2
收藏 15KB RAR 举报
zlflrhl
- 粉丝: 18
- 资源: 4
最新资源
- 2023-04-06-项目笔记 - 第一百十五阶段 - 4.4.2.113全局变量的作用域-113 -2024.04.26
- 2023-04-06-项目笔记 - 第一百十五阶段 - 4.4.2.113全局变量的作用域-113 -2024.04.26
- htmlzwbjq_downyi.com.zip
- 无头单向非循环链表的实现(Test.c)
- 无头单向非循环链表的实现(SList.c)
- 浏览器重定向插件更新文件
- SSA-BP麻雀算法优化BP神经网络多特征分类预测(Matlab实现完整源码和数据)
- 粒子群算法优化BP神经网络PSO-BP的MATLAB代码(数值预测)
- 基于Springboot的一起看书平台.zip
- 无头单向非循环链表的实现(SList.h)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈