• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP time函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中time函数的典型用法代码示例。如果您正苦于以下问题:PHP time函数的具体用法?PHP time怎么用?PHP time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了time函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: responseMsg

 public function responseMsg()
 {
     //get post data, May be due to the different environments
     $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
     //extract post data
     if (!empty($postStr)) {
         /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,
            the best way is to check the validity of xml by yourself */
         libxml_disable_entity_loader(true);
         $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
         $fromUsername = $postObj->FromUserName;
         $toUsername = $postObj->ToUserName;
         $keyword = trim($postObj->Content);
         $time = time();
         $textTpl = "<xml>\n\t\t\t\t\t\t\t<ToUserName><![CDATA[%s]]></ToUserName>\n\t\t\t\t\t\t\t<FromUserName><![CDATA[%s]]></FromUserName>\n\t\t\t\t\t\t\t<CreateTime>%s</CreateTime>\n\t\t\t\t\t\t\t<MsgType><![CDATA[%s]]></MsgType>\n\t\t\t\t\t\t\t<Content><![CDATA[%s]]></Content>\n\t\t\t\t\t\t\t<FuncFlag>0</FuncFlag>\n\t\t\t\t\t\t\t</xml>";
         if (!empty($keyword)) {
             $msgType = "text";
             $contentStr = "Welcome to wechat world!";
             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
             echo $resultStr;
         } else {
             echo "Input something...";
         }
     } else {
         echo "";
         exit;
     }
 }
开发者ID:sirxun,项目名称:uploadImag,代码行数:28,代码来源:wx_sample.php


示例2: save

 /**
  * Save an uploaded file to a new location.
  *
  * @param   mixed    name of $_FILE input or array of upload data
  * @param   string   new filename
  * @param   string   new directory
  * @param   integer  chmod mask
  * @return  string   full path to new file
  */
 public static function save($file, $filename = NULL, $directory = NULL, $chmod = 0755)
 {
     // Load file data from FILES if not passed as array
     $file = is_array($file) ? $file : $_FILES[$file];
     if ($filename === NULL) {
         // Use the default filename, with a timestamp pre-pended
         $filename = time() . $file['name'];
     }
     // Remove spaces from the filename
     $filename = preg_replace('/\\s+/', '_', $filename);
     if ($directory === NULL) {
         // Use the pre-configured upload directory
         $directory = WWW_ROOT . 'files/';
     }
     // Make sure the directory ends with a slash
     $directory = rtrim($directory, '/') . '/';
     if (!is_dir($directory)) {
         // Create the upload directory
         mkdir($directory, 0777, TRUE);
     }
     //if ( ! is_writable($directory))
     //throw new exception;
     if (is_uploaded_file($file['tmp_name']) and move_uploaded_file($file['tmp_name'], $filename = $directory . $filename)) {
         if ($chmod !== FALSE) {
             // Set permissions on filename
             chmod($filename, $chmod);
         }
         //$all_file_name = array(FILE_INFO => $filename);
         // Return new file path
         return $filename;
     }
     return FALSE;
 }
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:42,代码来源:UploadComponent.php


示例3: getAge

 public static function getAge($unix_timestamp)
 {
     $t = time();
     $age = $unix_timestamp < 0 ? $t + $unix_timestamp * -1 : $t - $unix_timestamp;
     $year = 60 * 60 * 24 * 365;
     return floor($age / $year);
 }
开发者ID:rawntech-rohan,项目名称:Project-CJ,代码行数:7,代码来源:Core_Utilities.php


示例4: flickr_faves_add_fave

function flickr_faves_add_fave(&$viewer, &$photo, $date_faved = 0)
{
    if (!$date_faved) {
        $date_faved = time();
    }
    $cluster_id = $viewer['cluster_id'];
    $fave = array('user_id' => $viewer['id'], 'photo_id' => $photo['id'], 'owner_id' => $photo['user_id'], 'date_faved' => $date_faved);
    $insert = array();
    foreach ($fave as $k => $v) {
        $insert[$k] = AddSlashes($v);
    }
    $rsp = db_insert_users($cluster_id, 'FlickrFaves', $insert);
    if (!$rsp['ok'] && $rsp['error_code'] != 1062) {
        return $rsp;
    }
    # now update the photo owner side of things
    $owner = users_get_by_id($photo['user_id']);
    $cluster_id = $owner['cluster_id'];
    $fave = array('user_id' => $owner['id'], 'photo_id' => $photo['id'], 'viewer_id' => $viewer['id']);
    $insert = array();
    foreach ($fave as $k => $v) {
        $insert[$k] = AddSlashes($v);
    }
    $rsp = db_insert_users($cluster_id, 'FlickrFavesUsers', $insert);
    if (!$rsp['ok'] && $rsp['error_code'] != 1062) {
        return $rsp;
    }
    # TO DO: index/update the photo in solr and insert $viewer['id']
    # into the faved_by column (20111123/straup)
    return okay();
}
开发者ID:nilswalk,项目名称:parallel-flickr,代码行数:31,代码来源:lib_flickr_faves.php


示例5: generateSecurekey

 /**
  *
  * @ORM\PrePersist
  */
 public function generateSecurekey()
 {
     $generator = new SecureRandom();
     $random = $generator->nextBytes(150);
     $securekey = md5($random . time());
     $this->setSecurekey($securekey);
 }
开发者ID:ssone,项目名称:cms-bundle,代码行数:11,代码来源:FieldType.php


示例6: login

 /**
  * 登陆,如果失败,返回失败原因(用户名或者密码不正确),如果成功,返回用户信息,
  * 附带返回系统服务器时间戳
  */
 public function login()
 {
     //查user表
     $User = M('User');
     check_error($User);
     $user = $User->field(array('id' => 'userId', 'username' => 'userName', 'name', 'role_id' => 'roleId', 'role'))->where(array('username' => safe_post_param('username'), '_string' => "`password`=MD5('" . safe_post_param('password') . "')"))->find();
     if (!empty($user)) {
         //根据权限查菜单
         $Menu = M('Menu');
         check_error($Menu);
         $menu = $Menu->join('`role_privilege` on `menu`.`id`=`role_privilege`.`menu_id`')->join('`user` on `user`.`role_id`=`role_privilege`.`role_id`')->field(array('`menu`.`id`', 'level', 'label', 'icon', 'widget', 'show', 'big_icon'))->where("`user`.`id`='" . $user['userId'] . "'")->order('`level` ASC')->select();
         check_error($Menu);
         //保存session
         session('logined', true);
         session('user', $user);
         session('menu', $menu);
         //设置返回数据
         $data = array();
         $data['serverTime'] = time();
         $data['user'] = $user;
         $data['menu'] = $menu;
         //保存日志
         R('Log/adduserlog', array('登录', '登录成功', '成功'));
         //返回结果:用户数据+服务器时间
         return_value_json(true, 'data', $data);
     } else {
         //保存日志
         R('Log/adduserlog', array('登录', '登录失败:用户名或者密码不正确', '失败:权限不够', '用户名:' . safe_post_param('username')));
         return_value_json(false, 'msg', '用户名或者密码不正确');
     }
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:35,代码来源:AuthenticateAction.class.php


示例7: collectData

 public function collectData(array $param)
 {
     $html = $this->file_get_html('http://www.maliki.com/') or $this->returnError('Could not request Maliki.', 404);
     $count = 0;
     $latest = 1;
     $latest_title = "";
     $latest = $html->find('div.conteneur_page a', 1)->href;
     $latest_title = $html->find('div.conteneur_page img', 0)->title;
     function MalikiExtractContent($url)
     {
         $html2 = $this->file_get_html($url);
         $text = 'http://www.maliki.com/' . $html2->find('img', 0)->src;
         $text = '<img alt="" src="' . $text . '"/><br>' . $html2->find('div.imageetnews', 0)->plaintext;
         return $text;
     }
     $item = new \Item();
     $item->uri = 'http://www.maliki.com/' . $latest;
     $item->title = $latest_title;
     $item->timestamp = time();
     $item->content = MalikiExtractContent($item->uri);
     $this->items[] = $item;
     foreach ($html->find('div.boite_strip') as $element) {
         if (!empty($element->find('a', 0)->href) and $count < 3) {
             $item = new \Item();
             $item->uri = 'http://www.maliki.com/' . $element->find('a', 0)->href;
             $item->title = $element->find('img', 0)->title;
             $item->timestamp = strtotime(str_replace('/', '-', $element->find('span.stylepetit', 0)->innertext));
             $item->content = MalikiExtractContent($item->uri);
             $this->items[] = $item;
             $count++;
         }
     }
 }
开发者ID:ORelio,项目名称:rss-bridge,代码行数:33,代码来源:MalikiBridge.php


示例8: session_init

/**
 * Initialize session.
 * @param boolean $keepopen keep session open? The default is
 * 			to close the session after $_SESSION has been populated.
 * @uses $_SESSION
 */
function session_init($keepopen = false)
{
    $settings = new phpVBoxConfigClass();
    // Sessions provided by auth module?
    if (@$settings->auth->capabilities['sessionStart']) {
        call_user_func(array($settings->auth, $settings->auth->capabilities['sessionStart']), $keepopen);
        return;
    }
    // No session support? No login...
    if (@$settings->noAuth || !function_exists('session_start')) {
        global $_SESSION;
        $_SESSION['valid'] = true;
        $_SESSION['authCheckHeartbeat'] = time();
        $_SESSION['admin'] = true;
        return;
    }
    // start session
    session_start();
    // Session is auto-started by PHP?
    if (!ini_get('session.auto_start')) {
        ini_set('session.use_trans_sid', 0);
        ini_set('session.use_only_cookies', 1);
        // Session path
        if (isset($settings->sessionSavePath)) {
            session_save_path($settings->sessionSavePath);
        }
        session_name(isset($settings->session_name) ? $settings->session_name : md5('phpvbx' . $_SERVER['DOCUMENT_ROOT'] . $_SERVER['HTTP_USER_AGENT']));
        session_start();
    }
    if (!$keepopen) {
        session_write_close();
    }
}
开发者ID:rgooler,项目名称:personal-puppet,代码行数:39,代码来源:utils.php


示例9: smarty_validate_criteria_isCCExpDate

/**
 * test if a value is a valid credit card expiration date
 *
 * @param string $value the value being tested
 * @param boolean $empty if field can be empty
 * @param array params validate parameter values
 * @param array formvars form var values
 */
function smarty_validate_criteria_isCCExpDate($value, $empty, &$params, &$formvars)
{
    if (strlen($value) == 0) {
        return $empty;
    }
    if (!preg_match('!^(\\d+)\\D+(\\d+)$!', $value, $_match)) {
        return false;
    }
    $_month = $_match[1];
    $_year = $_match[2];
    if (strlen($_year) == 2) {
        $_year = substr(date('Y', time()), 0, 2) . $_year;
    }
    $_month = (int) $_month;
    $_year = (int) $_year;
    if ($_month < 1 || $_month > 12) {
        return false;
    }
    if (date('Y', time()) > $_year) {
        return false;
    }
    if (date('Y', time()) == $_year && date('m', time()) > $_month) {
        return false;
    }
    return true;
}
开发者ID:ReneVallecillo,项目名称:almidon,代码行数:34,代码来源:validate_criteria.isCCExpDate.php


示例10: format_time

 public function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false)
 {
     global $forum_date_formats, $forum_time_formats;
     if ($timestamp == '') {
         return __('Never');
     }
     $diff = ($this->feather->user->timezone + $this->feather->user->dst) * 3600;
     $timestamp += $diff;
     $now = time();
     if (is_null($date_format)) {
         $date_format = $forum_date_formats[$this->feather->user->date_format];
     }
     if (is_null($time_format)) {
         $time_format = $forum_time_formats[$this->feather->user->time_format];
     }
     $date = gmdate($date_format, $timestamp);
     $today = gmdate($date_format, $now + $diff);
     $yesterday = gmdate($date_format, $now + $diff - 86400);
     if (!$no_text) {
         if ($date == $today) {
             $date = __('Today');
         } elseif ($date == $yesterday) {
             $date = __('Yesterday');
         }
     }
     if ($date_only) {
         return $date;
     } elseif ($time_only) {
         return gmdate($time_format, $timestamp);
     } else {
         return $date . ' ' . gmdate($time_format, $timestamp);
     }
 }
开发者ID:bohwaz,项目名称:featherbb,代码行数:33,代码来源:Utils.php


示例11: welcomeOp

 /**
  * 欢迎页面
  */
 public function welcomeOp()
 {
     /**
      * 管理员信息
      */
     $model_admin = Model('admin');
     $tmp = $this->getAdminInfo();
     $condition['admin_id'] = $tmp['id'];
     $admin_info = $model_admin->infoAdmin($condition);
     $admin_info['admin_login_time'] = date('Y-m-d H:i:s', $admin_info['admin_login_time'] == '' ? time() : $admin_info['admin_login_time']);
     /**
      * 系统信息
      */
     $version = C('version');
     $setup_date = C('setup_date');
     $statistics['os'] = PHP_OS;
     $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE'];
     $statistics['php_version'] = PHP_VERSION;
     $statistics['sql_version'] = Db::getServerInfo();
     $statistics['shop_version'] = $version;
     $statistics['setup_date'] = substr($setup_date, 0, 10);
     // 运维舫 c extension
     try {
         $r = new ReflectionExtension('shopnc');
         $statistics['php_version'] .= ' / ' . $r->getVersion();
     } catch (ReflectionException $ex) {
     }
     Tpl::output('statistics', $statistics);
     Tpl::output('admin_info', $admin_info);
     Tpl::showpage('welcome');
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:34,代码来源:dashboard.php


示例12: getData

 protected function getData($nowPage,$pageSize)
 {/*{{{*/
     $dataList = $this->prepareData($nowPage, $pageSize);
     $res = array();
     foreach ($dataList as $data)
     {
         $provinceKey = Area::getProvKeyByName($data['prov']);
         $tempData = array();
         $tempData['item']['key'] = $data['prov'].$data['dname'].'医院';
         $tempData['item']['url'] =  'http://www.haodf.com/jibing/'.$data['dkey'].'/yiyuan.htm?province='.$provinceKey;
         $tempData['item']['showurl'] = 'www.haodf.com';
         $tempData['item']['title'] = $data['prov'].$data['dname']."推荐医院_好大夫在线";
         $tempData['item']['pagesize'] = rand(58, 62).'K';
         $tempData['item']['date'] = date('Y-m-d', time());
         $tempData['item']['content1'] = "根据".$data['diseasevote']."位".$data['dname']."患者投票得出的医院排行";
         $tempData['item']['link'] = $tempData['item']['url'];
         foreach ($data['formdata'] as $formData)
         {
             $tempData['item'][] = $formData;
             unset($formData);
         }
         $res[] = $tempData;
         unset($data);
     }
     return $res;
 }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:26,代码来源:diseasehospitalwitharea.php


示例13: callback

 public function callback()
 {
     //$_REQUEST['MerchantTradeNo'] = "65";
     $this->load->model('checkout/order');
     //$query_url = "https://payment.allpay.com.tw/Cashier/QueryTradeInfo";
     $query_url = "https://payment.allpay.com.tw/Cashier/QueryTradeInfo";
     $timestamp = time();
     $hash_iv = $this->config->get('allpay_credit18_iv_key');
     $hash_key = $this->config->get('allpay_credit18_hash_key');
     $order_id = $_REQUEST['MerchantTradeNo'];
     $mer_id = $this->config->get('allpay_credit18_account');
     $order_finish_statu = $this->config->get('allpay_credit18_order_finish_status_id');
     $input_array = array("MerchantID" => $mer_id, "MerchantTradeNo" => $order_id, "TimeStamp" => $timestamp);
     ksort($input_array);
     $checkvalue = "HashKey={$hash_key}&" . urldecode(http_build_query($input_array)) . "&HashIV={$hash_iv}";
     $checkvalue = strtolower(urlencode($checkvalue));
     $checkvalue = md5($checkvalue);
     $input_array["CheckMacValue"] = $checkvalue;
     $post_data = http_build_query($input_array);
     $result = $this->curl_work($query_url, "POST", $post_data);
     parse_str($result["web_info"], $query_result);
     $order_info = $this->model_checkout_order->getOrder($order_id);
     $system_total_amt = intval(round($order_info['total']));
     if ($query_result["TradeStatus"] == "1" && $query_result["TradeAmt"] == $system_total_amt) {
         $this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '{$order_finish_statu}', date_modified = NOW() WHERE order_id = '" . $order_id . "'");
     }
 }
开发者ID:aaron1102,项目名称:ecbank,代码行数:27,代码来源:allpay_credit18.php


示例14: collectData

 public function collectData(array $param)
 {
     $page = 0;
     $tags = '';
     if (isset($param['p'])) {
         $page = (int) preg_replace("/[^0-9]/", '', $param['p']);
         $page = $page - 1;
         $page = $page * 50;
     }
     if (isset($param['t'])) {
         $tags = urlencode($param['t']);
     }
     $html = $this->file_get_html("http://mspabooru.com/index.php?page=post&s=list&tags={$tags}&pid={$page}") or $this->returnError('Could not request Mspabooru.', 404);
     foreach ($html->find('div[class=content] span') as $element) {
         $item = new \Item();
         $item->uri = 'http://mspabooru.com/' . $element->find('a', 0)->href;
         $item->postid = (int) preg_replace("/[^0-9]/", '', $element->getAttribute('id'));
         $item->timestamp = time();
         $item->thumbnailUri = $element->find('img', 0)->src;
         $item->tags = $element->find('img', 0)->getAttribute('alt');
         $item->title = 'Mspabooru | ' . $item->postid;
         $item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: ' . $item->tags;
         $this->items[] = $item;
     }
 }
开发者ID:ORelio,项目名称:rss-bridge,代码行数:25,代码来源:MspabooruBridge.php


示例15: testSetRefreshToken

 /** @dataProvider provideStorage */
 public function testSetRefreshToken(RefreshTokenInterface $storage)
 {
     if ($storage instanceof NullStorage) {
         $this->markTestSkipped('Skipped Storage: ' . $storage->getMessage());
         return;
     }
     // assert token we are about to add does not exist
     $token = $storage->getRefreshToken('refreshtoken');
     $this->assertFalse($token);
     // add new token
     $expires = time() + 20;
     $success = $storage->setRefreshToken('refreshtoken', 'oauth_test_client', '1', $expires, 'supportedscope1 supportedscope2');
     $this->assertTrue($success);
     $token = $storage->getRefreshToken('refreshtoken');
     $this->assertNotNull($token);
     $this->assertArrayHasKey('refresh_token', $token);
     $this->assertArrayHasKey('client_id', $token);
     $this->assertArrayHasKey('user_id', $token);
     $this->assertArrayHasKey('expires', $token);
     $this->assertEquals($token['refresh_token'], 'refreshtoken');
     $this->assertEquals($token['client_id'], 'oauth_test_client');
     $this->assertEquals($token['user_id'], '1');
     # reference from client
     $this->assertEquals($token['expires'], $expires);
     # should be expreRefreshToken?
     $this->assertTrue($storage->unsetRefreshToken('refreshtoken'));
 }
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:28,代码来源:RefreshTokenTest.php


示例16: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $mcid
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $mcid_id)
 {
     $this->validate($request, ['file' => 'required']);
     $mcid = MCID::findOrFail($mcid_id);
     $file = $_FILES['file'];
     $fileName = md5($mcid_id . $file['name'] . time());
     $path = str_finish($this->skin_path, '/') . $fileName;
     $content = File::get($file['tmp_name']);
     if (is_image($file['type']) && $file['size'] <= 150 * 1000) {
         list($img_w, $img_h) = getimagesize($file['tmp_name']);
         if ($img_w > 64 || $img_h > 64) {
             $error = "皮肤文件 '{$fileName}' 尺寸不正确.";
         } else {
             $result = $this->manager->saveFile($path, $content);
             if ($result === true) {
                 $skin = Skin::where('mcid_id', $mcid->id)->first();
                 if ($skin == null) {
                     $skin = new Skin();
                 }
                 $skin->mcid_id = $mcid->id;
                 $skin->url = $path;
                 $skin->save();
                 return redirect()->back()->withSuccess("皮肤文件 '{$fileName}' 上传成功.");
             } else {
                 $error = $result ?: "皮肤文件 '{$fileName}' 上传失败.";
             }
         }
     } else {
         $error = "皮肤文件 '{$fileName}' 格式或大小不正确.";
     }
     return redirect()->back()->withErrors([$error]);
 }
开发者ID:AsakuraFuuko,项目名称:MineCraft-Skin,代码行数:39,代码来源:SkinController.php


示例17: reply

 function reply($id)
 {
     if ($_POST) {
         $tto = (int) $this->input->post('tto');
         $id = (int) $this->input->post('id');
         $parent = (int) $this->input->post('parent');
         $subject = $this->input->post('subject');
         $msg = $this->input->post('msg');
         if ($id) {
             if (!$tto || !$subject || !$msg || !$parent) {
                 __set_error_msg(array('error' => 'Data that you entered is incomplete !!!'));
                 redirect(site_url('panel/support/reply/' . $id));
             } else {
                 if ($this->support_model->__insert_tickets(array('tto' => $tto, 'tuid' => $this->memcachedlib->sesresult['uid'], 'tdate' => time(), 'tsubject' => $subject, 'tmsg' => $msg, 'tparent' => $parent, 'tstatus' => 1))) {
                     __set_error_msg(array('info' => 'Ticket successfully sent !!!'));
                     redirect(site_url('panel/support'));
                 } else {
                     __set_error_msg(array('error' => 'Dissmiss input data !!!'));
                     redirect(site_url('panel/support/reply/' . $id));
                 }
             }
         } else {
             __set_error_msg(array('error' => 'Dissmiss input data !!!'));
             redirect(site_url('panel/support'));
         }
     } else {
         $view['id'] = $id;
         $view['detail'] = $this->support_model->__get_tickets_detail($this->memcachedlib->sesresult['uid'], $id);
         if (!$view['detail']) {
             __set_error_msg(array('error' => 'Dissmiss input data !!!'));
             redirect(site_url('panel/support'));
         }
         $this->load->view('pages/support_reply', $view);
     }
 }
开发者ID:ovarz,项目名称:cobablue,代码行数:35,代码来源:home.php


示例18: getTop3

function getTop3($db)
{
    $userid = $_SESSION['users'];
    $nowdate = date('Y-m-d', time());
    $datetime = strtotime(date("Y-m-d", time()));
    //获取当前日期并转换成时间戳
    $tomorrow = date('Y-m-d', $datetime + 86400);
    //在时间戳的基础上加一天(即60*60*24)
    $searchsql = "Select userid,sum(calorie) as allcal from Exercise where ( userid='{$userid}' or userid in (select friendid from Friendship where userid = '{$userid}')) and endTime<'{$tomorrow}' and endTime>='{$nowdate}' group by userid order by allcal desc limit 3";
    $result = $db->query($searchsql);
    $joinlist = '[';
    $count = 0;
    while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
        $usersid = $row['userid'];
        $sql = "Select nickname from user where userid='{$usersid}'";
        $rec = $db->query($sql);
        if ($row2 = $rec->fetchArray(SQLITE3_ASSOC)) {
            $username = $row2['nickname'];
        }
        $joinnode = array("username" => $username, "calorie" => $row['allcal']);
        foreach ($joinnode as $key => $value) {
            $joinnode[$key] = urlencode($value);
        }
        if ($count > 0) {
            $joinlist = $joinlist . ',';
        }
        $joinlist = $joinlist . urldecode(json_encode($joinnode));
        $count = $count + 1;
    }
    $joinlist = $joinlist . ']';
    echo $joinlist;
}
开发者ID:Kelsiii,项目名称:fitday,代码行数:32,代码来源:FriendInfo.php


示例19: page

function page()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $alias = $tpl->_ENGINE_parse_body("{alias}");
    $directory = $tpl->_ENGINE_parse_body("{directory}");
    $description = $tpl->_ENGINE_parse_body("{description}");
    $new_alias = $tpl->_ENGINE_parse_body("{new_directory}");
    $t = time();
    $buttons = "\n\tbuttons : [\n\t{name: '<b>{$new_alias}</b>', bclass: 'Add', onpress : AddNewAlias{$t}},\n\t\n\t\t],";
    $html = "\n\n<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:100%'></table>\n\n\t\n<script>\nvar mem{$t}='';\n\$(document).ready(function(){\n\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?freeweb-aliases-list=yes&servername={$_GET["servername"]}&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$directory}', name : 'directory', width :796, sortable : false, align: 'left'},\n\t\t{display: '&nbsp;', name : 'del', width : 31, sortable : true, align: 'center'},\n\t\t\n\t\t],\n\t{$buttons}\n\tsearchitems : [\n\t\t{display: '{$directory}', name : 'directory'},\n\t\t],\n\tsortname: 'directory',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: 900,\n\theight: 400,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t});   \n});\n\tfunction AddNewAlias{$t}(){\n\t\tYahooWin6('600','{$page}?new-alias=yes&servername={$_GET["servername"]}&t={$t}','{$new_alias}');\n\t}\n\t\n\t\tvar x_FreeWebAddAlias{$t}=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);return;}\t\n\t\t\t\$('#row'+mem{$t}).remove();\n\t\t}\t\t\n\t\n\tfunction FreeWebDelAlias{$t}(id){\n\t\tmem{$t}=id;\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DelAlias',id);\n\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\n    \t\tXHR.sendAndLoad('{$page}', 'POST',x_FreeWebAddAlias{$t});\t\t\n\t}\n\n\n</script>\n\n";
    //$('#flexRT$t').flexReload();
    echo $html;
    return;
    $page = CurrentPageName();
    $tpl = new templates();
    $free = new freeweb($_GET["servername"]);
    //if($free->groupware<>null){
    //echo $tpl->_ENGINE_parse_body("<div class=text-info>{freeweb_is_groupware_feature_disabled}</div>");
    //return;
    //}
    $free->CheckWorkingDirectory();
    $direnc = urlencode(base64_encode($free->WORKING_DIRECTORY));
    $html = "\n\t<p>&nbsp;</p>\n\t<div id='freeweb-aliases-list' style='width:100%;heigth:350px;overflow:auto'></div>\n\t\n\t\n\t\n\t<script>\n\t\tvar x_FreeWebAddAlias=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\t\n\t\t\tFreeWebAliasList();\t\n\t\t}\t\t\t\n\t\t\n\t\tfunction FreeWebAddAliasCheck(e){\n\t\t\tif(checkEnter(e)){FreeWebAddAlias();}\n\t\t}\n\t\t\n\t\tfunction FreeWebAddAlias(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tvar Alias=document.getElementById('alias_freeweb').value;\n\t\t\tif(Alias.length<2){return;}\n\t\t\tvar directory=document.getElementById('alias_dir').value;\n\t\t\tif(directory.length<2){return;}\t\t\t\n\t\t\tXHR.appendData('Alias',document.getElementById('alias_freeweb').value);\n\t\t\tXHR.appendData('directory',document.getElementById('alias_dir').value);\n\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\t\tAnimateDiv('freeweb-aliases-list');\n    \t\tXHR.sendAndLoad('{$page}', 'POST',x_FreeWebAddAlias);\t\t\t\n\t\t}\n\t\t\n\t\tfunction FreeWebDelAlias(id){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DelAlias',id);\n\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\t\tAnimateDiv('freeweb-aliases-list');\n    \t\tXHR.sendAndLoad('{$page}', 'POST',x_FreeWebAddAlias);\t\t\t\n\t\t}\t\t\n\t\t\n\t\tfunction FreeWebAliasList(){\n\t\t\tLoadAjax('freeweb-aliases-list','{$page}?freeweb-aliases-list=yes&servername={$_GET["servername"]}');\n\t\t}\n\tFreeWebAliasList();\n\t</script>\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:26,代码来源:freeweb.edit.openbasedir.php


示例20: save

 public function save()
 {
     $cover = $this->upload_file('product_cover');
     $download = $this->upload_file('userfile');
     $_POST['cover'] = $cover === '' ? $_POST['cover'] : '/uploads/' . $cover;
     $_POST['download'] = $download == '' ? '' : $download;
     foreach ($_POST as $key => $item) {
         if ($key === 'is_hot' || $key === 'desc' || $key === 'keywords') {
             continue;
         }
         //指定允许空值的字段
         if (empty($_POST[$key])) {
             unset($_POST[$key]);
         }
     }
     if (isset($_POST['id'])) {
         $_POST['ctime'] = strtotime($_POST['ctime']);
         $_POST['mtime'] = time();
         $this->articles_model->update($_POST);
     } else {
         $_POST['ctime'] = time();
         $_POST['mtime'] = time();
         $this->articles_model->insert($_POST);
     }
     echo json_encode(array('success' => true));
 }
开发者ID:tecshuttle,项目名称:color,代码行数:26,代码来源:articles.php



注:本文中的time函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP time2str函数代码示例发布时间:2022-05-23
下一篇:
PHP tie_thumb_src函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap