本文整理汇总了PHP中getCurrentTime函数的典型用法代码示例。如果您正苦于以下问题:PHP getCurrentTime函数的具体用法?PHP getCurrentTime怎么用?PHP getCurrentTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCurrentTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: txTest
/**
* 测试事务
*/
public function txTest()
{
$d = D();
//开始事务
$d->begin();
try {
$now = getCurrentTime();
//添加用户
$m = M("user");
$ud = array("mobile" => "1" . time(), "created" => $now);
$id = $m->add($ud);
//添加用户资料
$m = M("user_profile");
$profile = array("name" => "闵益飞" . $id, "user_id" => $id, "age" => 20, 'created' => $now, 'updated' => $now);
$m->add($profile);
//通过sql形式读取用户资料
$sql = "select a.mobile,b.name,b.age from user a,user_profile b where a.id=b.user_id";
$datas = $d->findSql($sql);
//如果没问题事务提交
$d->commit();
var_dump($datas);
} catch (Exception $e) {
//如果报错 事务回滚
$d->rollBack();
var_dump($e);
}
}
示例2: showScripttime
function showScripttime()
{
global $scriptTimeStart;
$scriptTimeEnd = getCurrentTime();
$scriptTimeDiv = intval(($scriptTimeEnd - $scriptTimeStart) * 1000) / 1000;
return $scriptTimeDiv;
}
示例3: searchEngine
/**
* 敏感分析服务
*
* @return void
*/
function searchEngine($data, $runtime = false)
{
$process_start_time = getCurrentTime();
$result = post(X::getConfigVar("searchEngine"), ["words" => cleanFormat($data['content']), 'if_spam' => $data['if_spam']]);
$process_end_time = getCurrentTime();
if ($runtime) {
$process_time = round($process_end_time - $process_start_time, 4);
//运行时间
return [$result, $process_time];
}
return $result;
}
示例4: BuildOCPSoap
function BuildOCPSoap()
{
/*
Select the right region for your CRM
crmna:dynamics.com - North America
crmemea:dynamics.com - Europe, the Middle East and Africa
crmapac:dynamics.com - Asia Pacific
*/
$region = 'crmapac:dynamics.com';
$OCPRequest = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
<a:MessageID>urn:uuid:%s</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">%s</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>%sZ</u:Created>
<u:Expires>%sZ</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-cdb639e6-f9b0-4c01-b454-0fe244de73af-1">
<o:Username>%s</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">%s</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
<wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<a:EndpointReference>
<a:Address>' . $region . '</a:Address>
</a:EndpointReference>
</wsp:AppliesTo>
<t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
</t:RequestSecurityToken>
</s:Body>
</s:Envelope>';
$OCPRequest = sprintf($OCPRequest, gen_uuid(), 'https://login.microsoftonline.com/RST2.srf', getCurrentTime(), getNextDayTime(), $this->username, $this->password);
return $OCPRequest;
}
示例5: process
public function process()
{
try {
$oTableOperate = new SingleTableOperation('cUser', "MYZL");
$data = $oTableOperate->getObject(array('userId' => $this->_args['userId']));
if (count($data)) {
$this->_retValue = EC_RECORD_EXIST;
$this->_retMsg = "user already exist!";
interface_log(ERROR, $this->_retValue, $this->_retMsg);
return false;
}
//添加用户记录,设置相关的字段,这里可以根据自己的策略设置
$oTableOperate->addObject(array('userId' => $this->_args['userId'], 'password' => $this->_args['password'], 'email' => $this->_args['email'], 'money' => 100, 'bulletNum' => 5, 'xsft' => 5, 'hdcx' => 5, 'chxs' => 5, 'sszm' => 5, 'addTimeStamp' => getCurrentTime()));
$this->_responseText = MYZL_HINT_ADDUSER_SUC;
} catch (DB_Exception $e) {
$errorNum = $oTableOperate->getErrorNum();
$this->_retMsg = $oTableOperate->getErrorInfo() . $e->getMessage();
$this->_retValue = genRetCode($errorNum);
interface_log(ERROR, $this->_retValue, $this->_retMsg);
return false;
}
return true;
}
示例6: phpexcel
public function phpexcel()
{
require_once APP_SITE_PATH . '/plugins/phpexcel/PHPExcel.php';
$title = "MyfMvc";
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("myf")->setLastModifiedBy("minyifei.cn")->setTitle($title)->setSubject($title)->setDescription($title)->setKeywords($title)->setCategory($title);
//设置excel的表头
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', '编号')->setCellValue('B1', '手机号')->setCellValue('C1', '姓名')->setCellValue('D1', '创建时间');
$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1);
$index = 2;
for ($i = 1; $i <= 9; $i++) {
$id = $i;
$mobile = "1371760000" . $i;
$name = "mvc" . $i;
$time = getCurrentTime();
$objPHPExcel->getActiveSheet()->setCellValue('A' . $index, $id)->setCellValue('B' . $index, $mobile)->setCellValue('C' . $index, $name)->setCellValue('D' . $index, $time);
$index++;
}
$objPHPExcel->getActiveSheet()->setTitle("客户统计");
$objPHPExcel->setActiveSheetIndex(0);
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $title . '.xls"');
header('Cache-Control: max-age=0');
header('Cache-Control: max-age=1');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// always modified
header('Cache-Control: cache, must-revalidate');
// HTTP/1.1
header('Pragma: public');
// HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
示例7: ProcessThread
function ProcessThread($threadid, $action, $params = array())
{
$res = null;
$newState = null;
$forExactOperatorMode = false;
$thread = Thread::getInstance()->GetThreadById($threadid);
// without changing state
switch ($action) {
case 'visitor_message':
$res = Thread::getInstance()->PostMessage($threadid, KIND_USER, $params['message'], $params['sendername']);
MapperFactory::getMapper("Thread")->incrementVisitorMessageCount($threadid);
case 'visitor_ping':
$this->ping($thread, $params, 'lastpingvisitor', 'visitortyping');
$thread = Thread::getInstance()->GetThreadById($threadid);
break;
case 'operator_message':
$res = Thread::getInstance()->PostMessage($threadid, KIND_AGENT, $params['message'], $params['sendername'], null, $params['operatorid']);
case 'operator_ping':
case 'operator_force_join':
$this->ping($thread, $params, 'lastpingagent', 'agenttyping');
$thread = Thread::getInstance()->GetThreadById($threadid);
break;
}
switch ($thread["state"]) {
case STATE_INVITE:
switch ($action) {
case 'visitor_ping':
case 'visitor_message':
Thread::getInstance()->PostMessage($threadid, KIND_FOR_AGENT, Resources::Get('client.joined.thread', array(), $thread['locale']));
$newState = STATE_CHATTING;
break;
case "operator_close":
$this->sendOperatorLeft($thread);
$newState = STATE_CLOSED;
break;
case 'operator_ping':
$session = VisitSession::getInstance()->GetVisitSessionById($thread['visitsessionid']);
if (isset($session) && isset($session['updated']) && getCurrentTime() - $session['updated'] > VISITED_PAGE_TIMEOUT) {
Thread::getInstance()->PostMessage($threadid, KIND_FOR_AGENT, Resources::Get('invite.window.closed', array(), $thread['locale']));
$newState = STATE_CLOSED;
}
break;
case 'visitor_invite_close':
Thread::getInstance()->PostMessage($threadid, KIND_FOR_AGENT, $params['message']);
$newState = STATE_CLOSED;
default:
if ($this->isCreatedTimeout($thread, INVITE_ANIMATION_DURATION + 30)) {
// TODO correct timeout
$newState = STATE_CLOSED;
}
}
break;
case STATE_LOADING_FOR_EXACT_OPERATOR:
$forExactOperatorMode = true;
case STATE_LOADING:
switch ($action) {
case 'visitor_ping':
case 'visitor_message':
VisitSession::getInstance()->UpdateVisitSession($thread['visitsessionid'], array('waitmess' => 0));
Thread::getInstance()->PostMessage($threadid, KIND_INFO, Resources::Get('chat.wait', array(), $thread['locale']));
$newState = $forExactOperatorMode ? STATE_QUEUE_EXACT_OPERATOR : STATE_QUEUE;
break;
case "visitor_browser_unload":
$newState = STATE_CLOSED;
break;
case 'operator_join':
case 'operator_force_join':
case 'operator_ping':
case 'operator_message':
$this->joinThreadAndSendMessage($thread, $params['operatorid']);
$newState = STATE_CHATTING;
break;
default:
if ($this->isCreatedTimeout($thread, TIMEOUT_VISITOR_PING)) {
$this->sendVisitorLeft($thread);
$newState = STATE_CLOSED;
}
}
break;
case STATE_QUEUE_EXACT_OPERATOR:
if ($this->isOperatorTimeout($thread, TIMEOUT_EXACT_OPERATOR) || $this->isCreatedTimeout($thread, TIMEOUT_EXACT_OPERATOR)) {
$newState = STATE_QUEUE;
break;
}
case STATE_REDIRECTED:
if ($this->isOperatorTimeout($thread, TIMEOUT_EXACT_OPERATOR)) {
$newState = STATE_QUEUE;
break;
}
case STATE_QUEUE:
switch ($action) {
case 'operator_join':
case 'operator_force_join':
case 'operator_ping':
case 'operator_message':
$this->joinThreadAndSendMessage($thread, $params['operatorid']);
$operators = Operator::getInstance()->getOnlineOperators($params['operatorid']);
$lvm = MapperFactory::getMapper("LostVisitor");
foreach ($operators as $operator) {
$lvm->addLostVisitor($threadid, $operator['operatorid'], $params['operatorid']);
//.........这里部分代码省略.........
示例8: BuildVisitorsXml
function BuildVisitorsXml()
{
$xml = array();
// папка online в мэмкэш --------------------
//VisitedPage::GetInstance()->retrieveVisitors();
VisitedPage::GetInstance()->retrieveVisitorsFromMemBuff();
$xml[] = "\n<visitors time=\"" . getCurrentTime() . "000\">";
$alive_visitors = VisitedPage::GetInstance()->getAliveVisitors();
foreach ($alive_visitors as $visitor) {
if (!isset($visitor)) {
continue;
}
$visitor['alive'] = true;
$xml[] = $this->BuildVisitorXml($visitor);
}
$dead_visitors = VisitedPage::GetInstance()->getDeadVisitors();
foreach ($dead_visitors as $visitor) {
if (!isset($visitor)) {
continue;
}
$visitor['alive'] = false;
$xml[] = $this->BuildVisitorXml($visitor);
}
$xml[] = '</visitors>';
return join("\n", $xml);
}
示例9: smarty_function_makePromlink
function smarty_function_makePromlink($params, &$smarty)
{
if (empty($params['links'])) {
return '';
}
$result = json_decode($params['links']);
//判断看有没有后门,得到后门的时间戳
function getCurrentTime()
{
$t = $_GET['promlink'];
if (empty($t)) {
return time();
} else {
return parseTime($t);
}
}
//把字符串时间转成时间戳
function parseTime($t)
{
//防止后门输入错误,如果后门输入错误,就使用当前时间
try {
return strtotime(str_replace('_', ' ', $t));
} catch (Exception $e) {
return time();
}
}
function setPromlinkElement($info)
{
$htmlstring = '';
if ($info) {
$htmlstring = '<img src="http://m.baidu.com/static/hb/hot.gif" /><a id="' . $info->id . '" href="' . $info->href . '" style="margin-left:5px;font-size:14px;">' . $info->text . '</a>';
}
return $htmlstring;
}
//取出当天的内容
$currentTime = getCurrentTime();
$currentLinks = array();
//
$pageData = $smarty->getTemplateVars('page');
if (empty($pageData)) {
$pageData = $smarty->getTemplateVars('pageData');
}
$isAndroid = $pageData['isAndroid'];
for ($i = 0, $len = count($result); $i < $len; $i++) {
$promlink = $result[$i];
$startTime = parseTime($promlink->time[0]);
$endTime = parseTime($promlink->time[1]);
if ($currentTime >= $startTime && $currentTime < $endTime) {
if ($isAndroid == 1) {
if (!empty($promlink->android)) {
array_push($currentLinks, $promlink->android);
}
} else {
if (!empty($promlink->ios)) {
array_push($currentLinks, $promlink->ios);
}
}
}
}
$currentLinksLength = count($currentLinks);
if ($currentLinksLength === 0) {
//当天没有
$htmlstring = setPromlinkElement(null);
} else {
if ($currentLinksLength === 1) {
//当天只有一个
$htmlstring = setPromlinkElement($currentLinks[0]);
} else {
//当天有多个,随机显示
$htmlstring = setPromlinkElement($currentLinks[rand(0, $currentLinksLength - 1)]);
}
}
return $htmlstring;
}
示例10: get
}
//发起get
function get(array $args, $url)
{
// $data = array ('foo' => 'bar');
$data = $args;
$data = http_build_query($data);
$opts = array('http' => array('method' => 'GET', 'timeout' => 60, 'header' => "Accept-language: zh-cn\r\n"));
$context = stream_context_create($opts);
$result = @file_get_contents($url . '?' . $data, false, $context);
return $result;
}
$google_ips = file_get_contents("./bbq_ip.txt");
$_ips = explode("\n", $google_ips);
$all_ip = array();
foreach ($_ips as $ip) {
$_start_coust = getCurrentTime();
$result = get(array('a' => 23), "http://" . $ip);
$_end_coust = round(getCurrentTime() - $_start_coust, 4);
if ($result) {
$all_ip[$ip] = $_end_coust;
} else {
$all_ip[$ip] = 0;
}
}
foreach ($all_ip as $p => $time) {
print $p . "=>" . $time . "\n";
}
// foreach($_ips as $ip){
// }
print "over";
示例11: buildTagsDropDownVersionPlusOne
/**
* Methods to display empty plus one row to allow user the ability to add an additional tag without Plus 'add' icon
* @param $itemList -- a list of selections from the [WEB] Project Deliverable Tags layout
* @param $index -- row number of item being added
* @param $displayList -- A list of tags with description separator of  
*/
function buildTagsDropDownVersionPlusOne($itemList, $index, $displayList)
{
global $log;
$log->debug("deliverableTagFieldBuilder - buildTagsDropDownPlusOneNew() - Running Plus One Time: " . getCurrentTime());
$noTagPkId = "noTagPkId" . "_tv_" . $index;
echo "<select class='tags tagsShowTwoChars' style='width: 40px;' id='" . $noTagPkId . "' name='" . $noTagPkId . "' onchange='processTagChanges(this.id);'>\n";
echo "<option value='' style='width: 160px;'></option>\n";
for ($index = 0; $index < count($itemList); $index++) {
echo "<option value='" . trim($itemList[$index]) . "' style='width: 150px;'>" . trim($displayList[$index]) . "</option>\n";
}
echo "</select>\n";
}
示例12: getCurrentTime_Format
function getCurrentTime_Format($show, $format)
{
$time = getCurrentTime();
$hours = substr($time, -8, 2);
$minutes = substr($time, -5, 2);
$seconds = substr($time, -2);
$pref = "";
if (!$format) {
if ($hours >= 13) {
$hours = $hours - 12;
$pref = " p. m.";
} else {
$pref = " a. m.";
}
}
switch ($show) {
case 'h':
return $hours . $pref;
break;
case 'm':
return $minutes . $pref;
break;
case 's':
return $seconds . $pref;
break;
case 'h:m':
return $hours . ":" . $minutes . $pref;
break;
case 'm:h':
return $minutes . ":" . $hours . $pref;
break;
case 'm:s':
return $minutes . ":" . $seconds . $pref;
break;
case 'h:m:s':
return $hours . ":" . $minutes . ":" . $seconds . $pref;
break;
case 'm:s:h':
return $minutes . ":" . $seconds . ":" . $hours . $pref;
break;
case 's:m:h':
return $seconds . ":" . $minutes . ":" . $hours . $pref;
break;
default:
return $hours . ":" . $minutes . ":" . $seconds;
break;
}
}
示例13: doUpdate
/**
* 执行更新操作
*/
public function doUpdate()
{
$data = M("Plan")->create();
$data['caseIds'] = implode(',', $data['caseIds']);
$data['updateTime'] = getCurrentTime();
$ret = M('Plan')->save($data);
if (empty($ret)) {
$this->ajaxReturn(null, '修改测试计划失败', 'success:false');
}
$this->ajaxReturn($ret, '成功', 'success:true');
}
示例14: isValidSession
private static function isValidSession($session)
{
return isset($session) && isset($session['visitsessionid']) && isset($session['updated']) && getCurrentTime() - $session['updated'] < VISIT_SESSION_TIMEOUT;
}
示例15: copy
/**
* 用例复制
*/
public function copy()
{
$id = $this->_post('id');
if (empty($id)) {
$this->ajaxReturn(null, '请选择需要复制的用例', 'success:false');
}
$case = D("Case")->relation(true)->getById($id);
unset($case['createTime']);
unset($case['id']);
$case['updateTime'] = getCurrentTime();
$case['userId'] = getUserId();
$case['desc'] = $case['desc'] . "--[复制]";
$steps = array();
foreach ($case['steps'] as $step) {
unset($step['createTime']);
unset($step['id']);
unset($step['caseId']);
$steps[] = $step;
}
$case['steps'] = $steps;
$ret = D("Case")->relation(true)->add($case);
if ($ret === false) {
$this->ajaxReturn(null, '复制用例失败,稍后重试!', 'success:false');
}
$this->ajaxReturn($ret, '成功', 'success:true');
}