最近在调试一些应用和UC整合,
其间经常遇到莫名其妙的问题,无法判断到底是什么原因导致的。
于是想了个简单的办法来处理,呵呵
我在api/uc.php 中添加几行代码。。
复制内容到剪贴板
代码:
if(MAGIC_QUOTES_GPC) {
foreach($get as $key=>$val) {
$get[$key] = stripslashes($val);
}
}
//========以下为添加的用于DEBUG的代码=====================
define('API_DEBUG',1); //需要的时候将调试开关打开,平时关闭即可
if(defined('API_DEBUG') && API_DEBUG)
{
$logfile=DISCUZ_ROOT.'./api/api.log';
!file_exists($logfile) && @touch(DISCUZ_ROOT.'./api/api.log');
$str=file_get_contents($logfile);
$str=date('Y-m-d H:i:s')."\n".var_export($get,TRUE)."\n\n".$str;
@file_put_contents($logfile,$str);
unset($str);
}
//========DEBUG代码结束====================
if(time() - $get['time'] > 3600) {
exit(time().'Authracation has expiried');
}这样在调试文件中可以得到很多调试信息
如下
复制内容到剪贴板
代码:
2008-04-26 23:31:23
array (
'action' => 'synlogin',
'username' => 'test22',
'uid' => '15',
'password' => 'cc35729f48ecaed3f2f8cc2073875820',
'time' => '1209223883',
)
2008-04-26 23:31:12
array (
'action' => 'synlogout',
'time' => '1209223872',
)
2008-04-26 23:31:05
array (
'action' => 'synlogin',
'username' => 'test2',
'uid' => '15',
'password' => 'cc35729f48ecaed3f2f8cc2073875820',
'time' => '1209223301',
)忘了说一个重要的的了
DISCUZ_ROOT.'./api/api.log' 这个是可以随便取名的的,但是必须是目录可写
[
本帖最后由 zhy_aid_cn 于 2008-4-28 13:39 编辑 ]