本文整理匯總了PHP中A函數的典型用法代碼示例。如果您正苦於以下問題:PHP A函數的具體用法?PHP A怎麽用?PHP A使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了A函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($token, $wechat_id, $data, $siteUrl, $key)
{
$this->wechat_id = $wechat_id;
$this->siteUrl = $siteUrl;
$this->token = $token;
$this->thisWxUser = M('Wxuser')->field('appid,appsecret,winxintype')->where(array('token' => $token))->find();
$this->keyword = $keyword = $key;
$this->db = M($data['module']);
$like['keyword'] = $keyword;
$like['precisions'] = 1;
$like['token'] = $this->token;
$data2 = M('keyword')->where($like)->order('id desc')->find();
if (!$data2) {
$like['keyword'] = array('like', '%' . $keyword . '%');
$like['precisions'] = 0;
$data2 = M('keyword')->where($like)->order('id desc')->find();
}
if ('img' == strtolower($data2['module']) && 2 < $this->thisWxUser['winxintype']) {
$groupid = $this->getGroupId();
$like2 = '( concat(\',\',wechat_group,\',\') LIKE \'%,' . $groupid . ',%\' OR wechat_group = \'\' ) ';
if ($like['precisions']) {
$like2 .= 'AND keyword = \'' . $like['keyword'] . '\' ';
} else {
$like2 .= 'AND keyword LIKE \'' . $like['keyword'][1] . '\' ';
}
$like2 .= 'AND precisions = \'' . $like['precisions'] . '\' ';
$like2 .= 'AND token = \'' . $like['token'] . '\' ';
$like = $like2;
}
$this->item = M($data2['module'])->field('id,text,pic,url,title')->limit(9)->order('usort desc')->where($like)->select();
$this->action = A('Home/Weixin');
}
示例2: callback
public function callback($type = null, $code = null)
{
header('content-type:text/html;charset=UTF-8;');
(empty($type) || empty($code)) && $this->error('參數錯誤');
//加載ThinkOauth類並實例化一個對象
import("ThinkSDK");
$sns = ThinkOauth::getInstance($type);
//騰訊微博需傳遞的額外參數
$extend = null;
if ($type == 'tencent') {
$extend = array('openid' => I("get.openid"), 'openkey' => I("get.openkey"));
}
//請妥善保管這裏獲取到的Token信息,方便以後API調用
//調用方法,實例化SDK對象的時候直接作為構造函數的第二個參數傳入
//如: $qq = ThinkOauth::getInstance('qq', $token);
$token = $sns->getAccessToken($code, $extend);
//獲取當前登錄用戶信息
if (is_array($token)) {
$user_info = A('Type', 'Event')->{$type}($token);
if ($_SESSION["MEMBER_type"] == 'local') {
self::_bang_handle($user_info, $type, $token);
} else {
self::_login_handle($user_info, $type, $token);
}
} else {
$this->success('登錄失敗!', U("Portal/index/index"));
}
}
示例3: download
public function download()
{
$r_mac = I('param.mac', '');
$Public = A('Public');
$webid = I('get.id', '');
$Web = M('website');
$web = $Web->join('rou_ap_main on rou_ap_main.id=rou_website.rid')->where('rou_ap_main.mac=' . $r_mac)->find();
foreach ($web as $k => $v) {
if ($v === '') {
$Public->error('請先配置站點');
}
}
$WebNav = M('webnav');
$nav = $WebNav->where(array('wid' => $webid, 'is_show' => 1))->select();
$navStr = '';
foreach ($nav as $item) {
$navStr .= '<option>' . $item['navname'] . '</option>';
}
$path = '/Down/' . $web['filename'] . '/';
//生成配置文件
$config = '<title>' . $web['web_name'] . '</title>
<address>' . $web['address'] . '</address>
<phone>' . $web['phone'] . '</phone>
<email>' . $web['email'] . '</email>
<nav>' . $navStr . '</nav>';
$suffix = date('YmdHis', time()) . '_' . rand(0, 999);
$hd = fopen(WEB_ROOT . $path . 'config_' . $suffix . '.txt', 'w') or die('無法打開文件');
fwrite($hd, $config);
fclose($hd);
$zip = new \Org\Util\PHPZip();
$zip->ZipAndDownload(WEB_ROOT . $path);
}
示例4: readMessage
public function readMessage()
{
$mailInbox = A("MisMessageInbox");
// 實例化UserAction控製器對象
$mailInbox->readMessage($_REQUEST['id'], false);
// 調用User模塊的importUser操作方法
}
示例5: module1
public function module1()
{
if (I('module', '', 'text') != '') {
$_SESSION['module'] = I('module', '', 'text');
}
$this->refreshSession();
$menus = $this->getSubMenus(0);
$all_menus = M('Menu')->where(array('status' => 1, 'module' => $this->module['name']))->select();
$this->assign('menus', $menus);
$controller_name = $this->module['name'];
$path = APP_PATH . $controller_name . '/' . 'Controller' . '/' . $controller_name . 'Controller.class.php';
if (file_exists($path)) {
require_once $path;
$controller = A('Admin/' . $controller_name);
$methods = $this->get_class_all_methods($controller);
foreach ($all_menus as &$v) {
$v['url'] = strtolower($v['url']);
}
unset($v);
$all_menus_url = getSubByKey($all_menus, 'url');
foreach ($methods as $m) {
if (!in_array(strtolower($this->module['name'] . '/' . $m['name']), $all_menus_url)) {
$havent_created[] = $m;
}
}
$this->assign('havent_created', $havent_created);
$this->assign('created', 1);
}
$this->display(T('Devtool@Admin/module1'));
}
示例6: edit
public function edit()
{
if (IS_POST) {
$arr = I('post.');
if (!$arr['msg']) {
$this->error('內容不能為空');
}
$arr['status'] = 1;
$arr['uid'] = 0;
$arr['type'] = 1;
$arr['create_time'] = time();
$message = array('title' => $arr['msg'], 'description' => $arr['msg']);
$push = A('Addons://Baidupush/push');
$push->__construct('', '', 1);
$push->pushMessage_all($message);
$push->__construct('', '', 2);
$push->pushMessage_all($message);
$res = M('baidu_msg')->add($arr);
if ($res) {
$this->success('推送成功', addons_url("Baidupush://Baidu/lists"));
} else {
$this->error('推送失敗');
}
} else {
$this->display(T('Addons://Baidupush@Baidu/edit'));
}
}
示例7: index
public function index()
{
$admin_config = new AdminConfigBuilder();
$data = $admin_config->handleConfig();
$mStep = A('Ucenter/RegStep', 'Widget')->mStep;
$step = array();
foreach ($mStep as $key => $v) {
$step[] = array('data-id' => $key, 'title' => $v);
}
$default = array(array('data-id' => 'disable', 'title' => '禁用', 'items' => $step), array('data-id' => 'enable', 'title' => '啟用', 'items' => array()));
//$default=array('禁用'=>$step,'啟用並可跳過'=>array(),'啟用但不可跳過'=>array());
$data['REG_STEP'] = $admin_config->parseKanbanArray($data['REG_STEP'], $step, $default);
empty($data['LEVEL']) && ($data['LEVEL'] = <<<str
0:Lv1 實習
50:Lv2 試用
100:Lv3 轉正
200:Lv4 助理
400:Lv 5 經理
800:Lv6 董事
1600:Lv7 董事長
str
);
empty($data['OPEN_QUICK_LOGIN']) && ($data['OPEN_QUICK_LOGIN'] = 0);
$admin_config->title('用戶配置')->keyCheckBox('REG_SWITCH', '注冊開關', '允許使用的注冊選項,全不選即為關閉注冊', array('username' => '用戶名', 'email' => '郵箱', 'mobile' => '手機'))->keyRadio('EMAIL_VERIFY_TYPE', '郵箱驗證類型', '郵箱驗證的類型', array(0 => '不驗證', 1 => '注冊後發送激活郵件', 2 => '注冊前發送驗證郵件'))->keyRadio('MOBILE_VERIFY_TYPE', '手機驗證類型', '手機驗證的類型', array(0 => '不驗證', 1 => '注冊前發送驗證短信'))->keyKanban('REG_STEP', '注冊步驟', '注冊後需要進行的步驟')->keyCheckBox('REG_CAN_SKIP', '注冊步驟是否可跳過', '勾選為可跳過,默認不可跳過', $mStep)->keyEditor('REG_EMAIL_VERIFY', '郵箱驗證模版', '用於進行郵箱的驗證', 'all')->keyEditor('REG_EMAIL_ACTIVATE', '郵箱激活模版', '用於進行用戶的激活')->keyCheckBox('SMS_SP', '短信提供商', '可選的短信通道提供商,全不選即為關閉短信通道', array('ucpaas' => '雲之訊', 'UCToo' => 'UCToo'))->keyText('SMS_HTTP', '短信平台HTTP', '短信平台HTTP')->keyText('SMS_HTTPS', '短信平台HTTPS', '短信平台HTTPS')->keyText('SMS_UID', '短信平台帳號', '短信平台帳號')->keyText('SMS_PWD', '短信平台密碼', '短信平台密碼')->keyText('SMS_ACCOUNTSID', '短信平台開發者ID', '短信平台開發者ID')->keyText('SMS_TOKEN', '短信平台TOKEN', '短信平台TOKEN')->keyText('SMS_APPID', '短信平台應用ID', '短信平台應用ID')->keyText('SMS_TEMPLATEID', '短信平台模板ID', '短信平台模板ID')->keyTextArea('SMS_CONTENT', '短信內容', '短信內容')->keyTextArea('LEVEL', '等級配置', '每行一條,名稱和積分之間用冒號分隔')->keyRadio('OPEN_QUICK_LOGIN', '快捷登錄', '默認關閉,開啟後用戶登錄方式更換成快捷登錄!', array(0 => '關閉', 1 => '開啟'))->group('注冊配置', 'REG_SWITCH,EMAIL_VERIFY_TYPE,MOBILE_VERIFY_TYPE,REG_STEP,REG_CAN_SKIP')->group('登錄配置', 'OPEN_QUICK_LOGIN')->group('郵箱驗證模版', 'REG_EMAIL_VERIFY')->group('郵箱激活模版', 'REG_EMAIL_ACTIVATE')->group('短信配置', 'SMS_SP,SMS_HTTP,SMS_HTTPS,SMS_UID,SMS_PWD,SMS_ACCOUNTSID,SMS_TOKEN,SMS_APPID,SMS_TEMPLATEID,SMS_CONTENT')->group('基礎設置', 'LEVEL')->buttonSubmit('', '保存')->data($data);
$admin_config->display();
}
示例8: getJsApiTicket
public function getJsApiTicket()
{
// jsapi_ticket 應該全局存儲與更新,以下代碼以寫入到文件中做示例
//$data = json_decode(file_get_contents("jsapi_ticket.json"));
//if ($data->expire_time < time()) {
$manage = A('Manage');
$accessToken = $manage::get_token(8);
//八點陽光的token
//$accessToken = $this->getAccessToken();
// 如果是企業號用以下 URL 獲取 ticket
// $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken";
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token={$accessToken}";
$res = json_decode($this->httpGet($url));
$ticket = $res->ticket;
if ($ticket) {
$data->expire_time = time() + 7000;
$data->jsapi_ticket = $ticket;
$fp = fopen("jsapi_ticket.json", "w");
fwrite($fp, json_encode($data));
fclose($fp);
} else {
$ticket = $data->jsapi_ticket;
}
//echo $ticket;die;
return $ticket;
}
示例9: showlist
function showlist()
{
//獲得User控製器的number方法返回的信息
//當前UserController會通過自動加載機製引入
//ThinkPHP/Library/Think/Think.class.php
// function autoload();
$user = new UserController();
//通過快捷函數實例化控製器對象
//new一個控製器對象給我們返回
//A([項目://][模塊/]控製器標誌);
$user = A("User");
echo $user->number();
$goods = A("Admin/Goods");
echo $goods->getMoney();
//跨項目、跨模塊調用指定控製器
//$index = A("book://Home/Index");
//echo $index -> getName();
//簡便操作
//R("[項目://][模塊/]控製器/操作方法")
//實例化對象之後再調用其對應的方法
echo R("User/number");
echo R("Admin/Goods/getMoney");
//echo R("book://Home/Index/getName");
$this->display();
}
示例10: userinfo
public function userinfo()
{
$common = A("Common/Common");
$common->getHomeMenu();
$common->getHomeSlide();
$this->display();
}
示例11: index
public function index()
{
$options = A(['order_by' => empty($this->sortable) ? 'id' : $this->sortable, 'order' => 'desc', 'per_page' => $this->per_page, 'page' => 0])->mergeF($this->params);
$this->paginate($options->per_page);
$where = [];
if (!empty($this->readable_fields)) {
foreach ($this->readable_fields as $field) {
if (!empty($this->params[$field])) {
$where[$field] = $this->params[$field];
}
}
}
if (!empty($this->belongs_to)) {
$where[$this->belongs_to['key']] = $this->parent_model->id;
}
if (!empty($this->viewmodel)) {
$model_class = $this->viewmodel;
} else {
$model_class = $this->model;
}
$model_object = $model_class::where($where);
if (!empty($this->join)) {
$model_object = $model_object->join($join);
}
if (!empty($this->readable_fields)) {
$model_object = $model_object->columns($this->readable_fields);
}
return $this->json($model_object->order($options->order_by, $options->order)->page($options->page, $options->per_page)->all());
}
示例12: indexCase
public function indexCase()
{
$result = A('Api')->getZhouchouAll();
//print_r('<pre>');
//print_r($result['data']);exit;
$this->assign('now', time());
$this->assign('zhongchou', $result['data']);
$this->model = D('Case');
$where = array('decoration_type' => 1);
if ($this->para['style'] > 0) {
$where = array('style' => $this->para['style']);
}
if ($this->para['housetype'] > 0) {
$where = array('housetype' => $this->para['housetype']);
}
$data = $this->model->getList($where, 'recommend desc, createtime desc', 6);
$this->assign('caseType1', $data);
$where = array('decoration_type' => 2);
if ($this->para['style']) {
$where = array_merge($where, array('style' => $this->para['style']));
}
if ($this->para['housetype']) {
$where = array_merge($where, array('housetype' => $this->para['housetype']));
}
$data = $this->model->getList($where, 'recommend desc, createtime desc', 6);
//var_dump($data);
$this->assign('caseType2', $data);
$this->assign('housetype', $this->_aBaseOptions['houseType']);
$this->assign('style', $this->_aBaseOptions['style']);
$this->assign('decorationType', $this->_aBaseOptions['decorationType']);
$this->assign('search', $this->para);
$this->display();
}
示例13: A
function A($k, $x1, $x2, $x3, $x4, $x5)
{
$b = function () use(&$b, &$k, $x1, $x2, $x3, $x4) {
return A(--$k, $b, $x1, $x2, $x3, $x4);
};
return $k <= 0 ? $x4() + $x5() : $b();
}
示例14: index
public function index()
{
if (session('current_item') != 'Diary' && session('?current_item')) {
$this->redirect(session('current_item') . "/index");
}
if ($_SESSION['LOGIN_STATUS']) {
C('LAYOUT_ON', TRUE);
//開啟模板布局
$cdt['userName'] = $_SESSION['USER_NAME'];
$diarys = $this->diary_model->where($cdt)->order('date desc')->limit(10)->select();
$totalCount = $this->diary_model->where($cdt)->count();
$totalPage = $totalCount / $this->page_size;
$this->assign('totalCount', $totalCount)->assign('pageSize', $this->page_size)->assign('totalPage', $totalPage);
for ($i = 0; $i < count($diarys); $i++) {
$diarys[$i]['tag'] = explode(" ", $diarys[$i]['tag']);
}
$user_info = A('User')->get_user_info(session('USER_NAME'));
$essay_nums = A('Essay')->get_essay_nums(session('USER_NAME'));
$diary_nums = A('Diary')->get_diary_nums(session('USER_NAME'));
$piece_nums = A('Piece')->get_piece_nums(session('USER_NAME'));
$this->assign('diarys', $diarys)->assign('user', $user_info)->assign(array('essay_nums' => $essay_nums, 'diary_nums' => $diary_nums, 'piece_nums' => $piece_nums));
$this->display();
} else {
$this->error('尚未登錄,無法操作!', U("Action/login"));
}
}
示例15: callback
public function callback($type = null, $code = null)
{
empty($type) && $this->error('參數錯誤');
if (empty($code)) {
redirect(__ROOT__ . "/");
}
//加載ThinkOauth類並實例化一個對象
import("ThinkOauth");
$sns = \ThinkOauth::getInstance($type);
//騰訊微博需傳遞的額外參數
$extend = null;
if ($type == 'tencent') {
$extend = array('openid' => I("get.openid"), 'openkey' => I("get.openkey"));
}
//請妥善保管這裏獲取到的Token信息,方便以後API調用
//調用方法,實例化SDK對象的時候直接作為構造函數的第二個參數傳入
//如: $qq = ThinkOauth::getInstance('qq', $token);
$token = $sns->getAccessToken($code, $extend);
//獲取當前登錄用戶信息
if (is_array($token)) {
$user_info = A('Type', 'Event')->{$type}($token);
if (!empty($_SESSION['oauth_bang'])) {
$this->_bang_handle($user_info, $type, $token);
} else {
$this->_login_handle($user_info, $type, $token);
}
} else {
$this->success('登錄失敗!', $this->_get_login_redirect());
}
}