本文整理匯總了PHP中Device::getOne方法的典型用法代碼示例。如果您正苦於以下問題:PHP Device::getOne方法的具體用法?PHP Device::getOne怎麽用?PHP Device::getOne使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Device
的用法示例。
在下文中一共展示了Device::getOne方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: message
$ret = $c->create($r);
if (is_error($ret)) {
message($ret['message']);
} else {
message('成功同步設備', $this->createWebUrl('devices'));
}
} else {
exit('設備無效或未激活');
}
}
include $this->template('device-download');
}
if ($foo == 'modify') {
$id = $_GPC['id'];
$g = new Device();
$entity = $g->getOne($id);
if (empty($entity)) {
message('訪問錯誤');
}
if ($_W['ispost']) {
$a = new Api();
$title = $_GPC['title'];
$re = $a->setDeviceTitle($entity['device_id'], $title);
if (is_error($re)) {
message($re['message']);
} else {
$c = new Device();
$entity['title'] = $title;
$ret = $c->modify($id, $entity);
if (is_error($ret)) {
message($ret['message']);
示例2: intval
}
if ($foo == 'devices') {
$id = $_GPC['id'];
$id = intval($id);
$a = new Activity();
$activity = $a->getOne($id);
if (empty($activity)) {
$this->error('訪問錯誤');
}
$d = new Device();
if ($_W['ispost']) {
$api = new Api();
$devices = $_GPC['device'];
if ($_GPC['type'] == 'bind') {
foreach ($devices as $did) {
$device = $d->getOne($did);
if (!empty($device)) {
$ret = $api->setDevicePages($device['device_id'], array(intval($activity['page'])));
$d->touchActivity($did, $id);
}
}
}
if ($_GPC['type'] == 'unbind') {
foreach ($devices as $did) {
$device = $d->getOne($did);
if (!empty($device)) {
$ret = $api->setDevicePages($device['device_id'], array(intval($activity['page'])), false);
$d->touchActivity($did, 0);
}
}
}
示例3: mediaUpload
$url = "https://api.weixin.qq.com/shakearound/page/delete?access_token={$token}";
$pars = array();
$pars['page_ids'][0] = intval($id);
$resp = ihttp_post($url, json_encode($pars));
if (is_error($resp)) {
return $resp;
}
$ret = @json_decode($resp['content'], true);
if (is_array($ret) && $ret['errcode'] == '0') {
return true;
}
return error(-1, $resp['content']);
}
/**
* 上傳圖片素材
* @param $file string 要上傳的文件
* @return string
*/
public function mediaUpload($file)
{
$file = IA_ROOT . '/attachment/' . $file;
$token = $this->getAccessToken();
$url = "https://api.weixin.qq.com/shakearound/material/add?access_token={$token}";
$body = array();
if (function_exists('curl_file_create')) {
$body['media'] = curl_file_create($file);
} else {
$body['media'] = '@' . $file;
}
$resp = @ihttp_request($url, $body);
if (is_error($resp)) {
return $resp;