·ÖÏí¼¸¸öphpʱ¼äÏà¹ØµÄº¯Êý
function FormatShowTime($nTotalSec)
{
//echo "total sec:" . $nTotalSec . '<br>';
$strTime = "";
//day
if ($nTotalSec > 3600 * 24)
{
$nDay = (int)($nTotalSec / (3600 * 24));
//$nDay > 0 ? $nDay : 1;
$strTime = $nDay;
$strTime .= 'Ìì';
//echo "nDay:" . $nDay . '<br>';
}
//hour
if ($nTotalSec > 3600)
{
$nHour = ((int)($nTotalSec / 3600)) % 24;
//$nHour > 0 ? $nHour : 1;
$strTime .= $nHour;
$strTime .= 'ʱ';
//echo "nHour:" . $nHour . '<br>';
}
//miniute
if ($nTotalSec > 60)
{
//$nMin = ceil($nTotalSec / 60) % 60 ;
$nMin = ((int)($nTotalSec / 60)) % 60;
//$nMin > 0 ? $nMin : 1;
$strTime .= $nMin;
$strTime .= '·Ö';
//echo "nMin:" . $nMin . '<br>';
}
//second
$nSec = $nTotalSec % 60 ;
$strTime .= $nSec;
$strTime .= 'Ãë';
//echo $strTime . '<br>';
return $strTime;
}
function SubTime($last_time, $before_time)
{
$year = 0;
$month = 0;
$day = 0;
$hour = 0;
$min = 0;
$sec = 0;
//get time pram
GetTimeParam($last_time, $year, $month, $day, $hour, $min, $sec);
$nLastTime = mktime($hour, $min, $sec, $month, $day, $year);
GetTimeParam($before_time, $year, $month, $day, $hour, $min, $sec);
$nCurrTime = mktime($hour, $min, $sec, $month, $day, $year);
$nSubTime = ($nCurrTime - $nLastTime);
return $nSubTime;
}
function GetTimeParam($strTime, &$year, &$month, &$day, &$hour, &$min, &$sec)
{
//echo "$strTime=" . $strTime . '<Br>';
//2010-01-26 12:45:04
$arr = explode(" ", $strTime);
//echo '$arr[0] = ' . $arr[0] . '<br>';$arr[0] = 2010-01-26
//echo '$arr[1] = ' . $arr[1] . '<br>';$arr[1] = 16:44:44
//get year...
$arr1 = explode('-', $arr[0]);
$arr2 = explode(':', $arr[1]);
$year = $arr1[0];
$month = $arr1[1];
$day = $arr1[2];
$hour = $arr2[0];
$min = $arr2[1];
Ïà¹ØÎĵµ£º
1.
error_reporting(E_ERROR | E_WARNING | E_PARSE); //±¨´í¼¶±ð
@set_time_limit(1000); //ÉèÖú¯ÊýÖ´ÐеÄ×î´óʱ¼ä
set_magic_quotes_runtime(0); //ΪÁË°²È«
define('IN_COMSENZ', TRUE);
define('ROOT_PATH', dirname(__FILE__).'/../');   ......
Ò»¡¢¹æ·¶Ç°ÑÔƪ
±ê×¼»¯²»ÊÇÌØÊâµÄ¸öÈË·ç¸ñ£¬ËüÈóÌÐòÔ±¿ÉÒÔÁ˽âÈκδúÂ룬ŪÇå³ÌÐòµÄ×´¿ö£»ÐÂÈË¿É
ÒԺܿìµÄÊÊÓ¦»·¾³£»·ÀֹнӴ¥phpµÄÈËÒ»´Î´ÎµÄ·¸Í¬ÑùµÄ´íÎó£»ÔÚÒ»ÖµĿª·¢»·¾³Ï£¬
¿ÉÒÔ¼õÉÙÈËÃÇ·¸´íµÄ»ú»á¡£±¾¹æ·¶µÄ±ê×¼ÔÚ¾ø¶Ô¶àÊýÓ¦ÓÃÉÏΪ·ÂÕÕjava¼¼ÊõÌåϵ£¬ÒòΪ
java¼¼ÊõÌåϵÒÔÆäÖÚ¶à³É¹¦µÄ°¸Àý³ÉΪ´ó²¿·Ö¼ÆËã»úÓ¦Ó ......
import java.io.IOException;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class DES {
private byte ......
index.php:
$smarty = new Smarty;
$smarty->assign('Contacts',
array('555-222-9876',
'zaphod@slartibartfast.com',
array('555-444-3333',
'555-111-1234')));
$smarty->display('index.tpl');
index.tpl:
{$Contacts[0]}<br>
{$Contacts[1]}<br>
{* you can print arrays of arrays ......
index.php:
$smarty = new Smarty;
$smarty->assign('Contacts',
array('555-222-9876',
'zaphod@slartibartfast.com',
array('555-444-3333',
'555-111-1234')));
$smarty->display('index.tpl');
index.tpl:
{$Contacts[0]}<br>
{$Contacts[1]}<br>
{* you can print arrays of arrays ......