首 页   · 站长博客 · 用户注册 · 会员登陆  · 会员排行  ·最新主题  ·最近回复  精华区  版权声明  ·论坛管理
  当前登录身份:游客,请先登录。  笔名: 口令: 验证码:   
楼 主  index »  PHP与模板与代码加密/优化 » [原创]获得当前时间的问题,急,请高手帮忙,先谢谢了。  


  作者:michaelehome
  注册时间:2006-11-20
  主题/回复:1/1
  积分:406
  等级:★★☆(五级)
  称号:略有小成

  michael@sunrisea..
  未提供
  michaelsunrisea.spaces.live.com

 

 发表:2006-11-20 17:40:54 阅读 3867 次 回复 2 次 得分1  |   字号 字色
[原创]获得当前时间的问题,急,请高手帮忙,先谢谢了。
目前,我有一个PHP的网页,想在其中输出时间戳,可是还在如果使用echo输出时间,页面中的其他信息就不见了,请哪位高人,给指点一二。
在下面代码中的"//I want to print current datetime"这个位置上我想输出当前时间。

<?
require_once('UserLogin.php'); 
require_once('UserProfileClass.php'); 
require_once('common.php'); 

//̒˹ꐠdefault ·֨¨? display 㷠home =============================
$go=$_REQUEST["go"];
$go_url="";
$id = (isset($_REQUEST["id"]))?$_REQUEST["id"]:0;
$url_map = array(
"photo"=>"$MINIHOME_DOMAIN/home/photo_main.php?id=" . $id,
"diary"=> "$MINIHOME_DOMAIN/home/diary_main.php?id=" .$id,
    "room"=> "$MINIHOME_DOMAIN/home/room_main.php?id=" .$id,
"profile"=> "$MINIHOME_DOMAIN/home/profile_main.php?id=" .$id,
"guestbook"=> "$MINIHOME_DOMAIN/home/guestbook_main.php?id=" .$id,
"music"=>"$MINIHOME_DOMAIN/home/music.php?id=" .$id,
"locker"=> "$MINIHOME_DOMAIN/home/locker.php?id=" .$id,
"tool"=> "$MINIHOME_DOMAIN/home/tool_main.php?id=" .$id
);
$go_url  = (array_key_exists($go,$url_map))? $url_map[$go]:"$MINIHOME_DOMAIN/home/home_main.php?id=" . $id;

//´֧¢ꎁ׿ Profile ¢˿ user 传¡胣¹ JavaScript =============================
$serviceApi = $TL_SERVICE_DOMAIN."/service/ups/info?id=".$id;
$cache = new Cache();
if($userid != $id){
$userProfile = $cache->getGlobalCache($serviceApi);
}else{
$userProfile = FALSE;
}
if($userProfile==FALSE){
try{
//I want to print current datetime
$doc = getServiceDocument($serviceApi);
$node = $doc->getElementsByTagName('user');
$userProfile = new UserProfile($node);
$cache->setGlobalCache($serviceApi,$userProfile);
}catch(Exception $e){
$cache->close();
$url = $HOME_DOMAIN."/common/url_false.php?code=".$e->getCode()."&detail=".$e->getMessage();
echo '<script type="text/javascript"> window.location = "'.$url.'"</script>';
}
}
$cache->close();

$user_profile = array(
"userid" => $userProfile->userid,
"username" => $userProfile->username,
"displayname" => $userProfile->displayname,
"invite" => $userProfile->invite
);
?>
<html>
<head>
<title>TrueLife: miniHome</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript" type="text/javascript" src="jscripts/wmPlayer.js"></script>
<script language="javascript" type="text/javascript">
function UserProfile(){
this.userid=null;
this.username=null;
this.displayname=null;
}
var userProfile = new UserProfile();
userProfile.userid="<?=$user_profile['userid']?>";
userProfile.username="<?=$user_profile['username']?>";
userProfile.invite="<?=$user_profile['invite']?>";
userProfile.displayname="<?=str_replace("\"",""",$user_profile['displayname'])?>";

window.focus();
</script>
</head>

<frameset rows="0,*,0"  border="1" framespacing="0" frameborder="yes" name="minihome">
<frame name="backmusic" frameborder="no" border=0 marginwidth=0 marginheight=0  scrolling=no src="control_mediaplayer.php?id=<?=$id?>">

<frame name="minihome_main" id="minihome_main" frameborder="no" border=0 marginwidth=0 marginheight=0  scrolling=no src="<?=$go_url?>">
<frame name="session" frameborder="no" border=0 marginwidth=0 marginheight=0  scrolling=no src="control_session.php?id=<?=$id?>">
</frameset>
<noframes></noframes>

</html>
 
 1#楼  
 
  回复人:michaelehome
  注册时间:2006-11-20
  主题/回复:1/1
  积分:406
  等级:★★☆(五级)
  称号:略有小成

   
 1#楼 发表于2006-11-20 17:44:26  评分:× 

忘了说一点,如果没有办法实现的话也可以,请各位给出不能实现的原因,谢谢,现在急着交差。
 2#楼  
 
  回复人:一起PHP
  注册时间:2004-02-27
  主题/回复:247/1521
  积分:4649
  等级:★★★★★☆(十一级)
  称号:论坛圣人

   
 2#楼 发表于2006-11-22 04:50:43  评分:1 

晕..这么一大堆代码就是输出一个时间戳么?

查PHP手册关于 日期/时间 函数部分,很多函数可以直接用,应该不复杂。
  页数1/1首页 « 1 » 末页
  发表回复:您还没有登陆,无法发表回复。请先[登陆]

一起PHP技术联盟 主办:一起PHP 联系方式:站长QQ:4304410 QQ群:8423742 20159565 站长博客 E-mail: nqp@nqp.me 执行时间:0.008sec
SimsmaBBS 2008 (v6.0) Developed by 17php.com,Copyright(C)2003-2010 All rights reserved. 副本授权:一起PHP官方专用版