本文整理汇总了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());
}
}