当前位置: 首页>>代码示例>>PHP>>正文


PHP Browser::openUrl方法代码示例

本文整理汇总了PHP中Browser::openUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Browser::openUrl方法的具体用法?PHP Browser::openUrl怎么用?PHP Browser::openUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Browser的用法示例。


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

示例1: action_save

 public function action_save()
 {
     $msg = '';
     $user_id = $this->request->post('user_id');
     $b = new Browser();
     $url = "https://api.vk.com/method/users.get?user_ids=" . $user_id;
     $response = $b->openUrl($url)->jsonAsArray();
     if (isset($response['response'])) {
         foreach ($response['response'] as $user) {
             $userRecord = ORM::factory('User')->where('user_id', '=', $user['uid'])->find_all();
             if (count($userRecord)) {
                 $msg = 'Пользователь уже добавлен';
                 $this->template->content = View::factory('msg/error')->bind('msg', $msg);
             } else {
                 $newUser = ORM::factory('User');
                 $newUser->user_id = $user['uid'];
                 $newUser->first_name = $user['first_name'];
                 $newUser->last_name = $user['last_name'];
                 if ($newUser->save()) {
                     $msg = "Добавлен";
                     $this->template->content = View::factory('msg/success')->bind('msg', $msg);
                 }
             }
         }
     }
 }
开发者ID:stellio,项目名称:vTrack,代码行数:26,代码来源:User.php

示例2: users

// class and creates the table if it doesn't already exist.
// Wouldn't normally be needed if the table is already there.
$db = ORM::get_db();
$db->exec("\n        CREATE TABLE IF NOT EXISTS users (\n            id INTEGER PRIMARY KEY AUTO_INCREMENT, \n            user_id TEXT,\n            first_name TEXT,\n            last_name TEXT\n        ) DEFAULT CHARSET=utf8;");
$db->exec("\n\t\tCREATE TABLE IF NOT EXISTS trackers (\n    \t\tid INTEGER PRIMARY KEY AUTO_INCREMENT, \n    \t\tuser_id TEXT,\n\t\t\tdate TEXT,\n\t\t\tparams TEXT\n\t\t) DEFAULT CHARSET=utf8;");
$users = ORM::for_table('users')->find_many();
$idList = array();
foreach ($users as $user) {
    $idList[] = $user->user_id;
}
$idList = implode(',', $idList);
$b = new Browser();
// $url =  "https://api.vk.com/method/users.get?user_ids=101009040,parruslt&fields=online,online_mobile";
$url = sprintf("https://api.vk.com/method/users.get?user_ids=%s&fields=online,online_mobile", $idList);
// $url =  "https://api.vk.com/method/users.get?user_ids=138355715&fields=online,online_mobile";
$response = $b->openUrl($url)->jsonAsArray();
// echo "<pre>";
// print_r($response);
// echo "</pre>";
// exit();
if (isset($response['response'])) {
    foreach ($response['response'] as $user) {
        $userRecord = ORM::for_table('users')->where('user_id', $user['uid'])->find_one();
        if ($userRecord) {
            if (isset($user['online']) && $user['online'] == '1') {
                $currentDate = date('Y.m.d');
                $trackRecord = ORM::for_table('trackers')->where(array('user_id' => $user['uid'], 'date' => $currentDate))->find_one();
                if ($trackRecord) {
                    $params = unserialize($trackRecord->params);
                    $params[] = array('time' => date('H:i'), 'from_mobile' => isset($user['online_mobile']) ? 1 : 0, 'from_mobile_app' => isset($user['online_app']) ? 1 : 0);
                    $trackRecord->params = serialize($params);
开发者ID:stellio,项目名称:vTrack,代码行数:31,代码来源:update.php


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