本文整理汇总了PHP中F函数的典型用法代码示例。如果您正苦于以下问题:PHP F函数的具体用法?PHP F怎么用?PHP F使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了F函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($modelid, $catid = 0, $categorys = array())
{
$this->modelid = $modelid;
$this->catid = $catid;
$this->categorys = $categorys;
$this->fields = F("Model_field_" . $modelid);
}
示例2: friend
/**
* 主页
*/
public function friend()
{
//获取好友列表
$mfriend_list = F('mfriend_list' . $this->qq['qq']);
$mfriend_list = null;
if (!unserialize($mfriend_list)) {
$url = "http://r.cnc.qzone.qq.com/cgi-bin/tfriend/friend_mngfrd_get.cgi?uin=" . $this->qq['qq'] . "&rd=" . rand(1, 999) . "&g_tk=" . $this->qq['gtk'];
$result = $this->sendToQq($url);
$result = $this->filterCallback($result);
$results = json_decode($result);
F('mfriend_list' . $this->qq['qq'], serialize($results));
} else {
$results = unserialize($mfriend_list);
}
$datas = $results->items;
$gpnames = $results->gpnames;
//存储相关数据
//F('fl_' . $this->qq['qq'], $results);
$this->groud = $gpnames;
//$this->autoZantask = F('zan_lock_' . $this->qq['qq']);
//$this->autoCommtask = F('comm_lock_' . $this->qq['qq']);
//设置cookie
$this->assign("qq", $this->qq['qq']);
$this->assign("groud", $gpnames);
$this->assign("data", $datas);
$this->display();
}
示例3: cate
/**
* 专辑分类
* 如果用户传入了非默认field,order则直接查询数据库,所以不推荐传入这些参数
* @param array $options
*/
public function cate($options)
{
$options['field'] = isset($options['field']) ? trim($options['field']) : '*';
$options['where'] = isset($options['where']) ? trim($options['where']) : '';
$options['num'] = isset($options['num']) ? intval($options['num']) : 0;
$options['order'] = isset($options['order']) ? trim($options['order']) : 'ordid';
if ($options['field'] != '*' || $options['where'] || $options['order'] != 'ordid') {
$album_cate_mod = M('album_cate');
$map = array('status' => '1');
$select = $album_cate_mod->field($options['field']);
//字段
$options['where'] && ($map['_string'] = $options['where']);
$select->where($map);
//条件
$options['num'] && $select->limit($options['num']);
//个数
$select->order($options['order']);
//排序
$data = $select->select();
} else {
//分类缓存
if (false === ($cate_list = F('album_cate_list'))) {
$cate_list = D('album_cate')->cate_cache();
}
$options['num'] && ($cate_list = array_slice($cate_list, 0, $options['num']));
$data = $cate_list;
}
return $data;
}
示例4: __construct
public function __construct()
{
parent::__construct();
$this->assign('controller', CONTROLLER_NAME);
//读取配置信息
$web_stting = F('setting');
if ($web_stting === false) {
$params = array();
$list = M('Setting')->getField('name,value');
foreach ($list as $key => $val) {
$params[$key] = unserialize($val) ? unserialize($val) : $val;
}
F('setting', $params);
$web_stting = F('setting');
}
$this->web_stting = $web_stting;
//站点状态判断
if ($this->web_stting['site_status'] != 1) {
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo $this->web_stting['closed_reason'];
exit;
} else {
$this->assign('seo', seo());
}
//检查登录
/* session('member_id',null);
if(!session('member_id'))
{
$this->wx_auto_login(); //自动登录
}
$this->mid = session('member_id'); */
$this->mid = 10;
$this->m_info = M('Member')->where('member_id=' . $this->mid)->find();
}
示例5: update_cache
public function update_cache()
{
//获得表中的所有栏目数据
$category = Data::tree($this->all(), 'cname');
return F("category", $category);
//file_put_contents()储存文件缓存
}
示例6: __construct
/**
* 构造函数
*/
public function __construct()
{
/**
* 验证圈子是否开启
*/
if (C('circle_isuse') != '1') {
@header('location: ' . SHOP_SITE_URL);
die;
}
/**
* 读取通用、布局的语言包
*/
Language::read('common');
/**
* 设置布局文件内容
*/
Tpl::setLayout('circle_layout');
/**
* 查询是否是超管
*/
$this->checkSuper();
/**
* 获取导航
*/
Tpl::output('nav_list', ($nav = F('nav')) ? $nav : rkcache('nav', true, 'file'));
}
示例7: G
function G()
{
static $myvar = 4;
echo "{$myvar} ";
echo F();
echo "{$myvar}";
}
示例8: index
public function index()
{
//URL规则
$urlrules = F('urlrules');
$where = array();
if (isset($_GET['tagid'])) {
$where['tagid'] = array("EQ", (int) $this->_get("tagid"));
$r = M("Tags")->where($where)->find();
$where['tag'] = $r['tag'];
unset($where['tagid']);
} else {
$where['tag'] = array("EQ", $this->_get("tag"));
}
$data = M("Tags")->where($where)->find();
if (!$data) {
$this->error("该Tag不存在!");
}
$this->assign($data);
M("Tags")->where($where)->setInc("hits");
M("Tags")->where($where)->save(array("lasthittime" => time()));
$page = $this->_get(C("VAR_PAGE"));
$this->assign("page", $page);
$urlrules = $urlrules[CONFIG_TAGURL];
define('URLRULE', str_replace('|', '~', str_replace(array('{$tag}', '{$tagid}'), array($this->_get('tag'), (int) $this->_get("tagid")), $urlrules)));
$SEO = seo();
//seo分配到模板
$this->assign("SEO", $SEO);
//把分页分配到模板
$this->assign(C("VAR_PAGE"), $page);
$this->display("Tags:tag");
}
示例9: _initialize
/**
* 系统初始化方法
*
* @access protected
*/
protected function _initialize()
{
header("Content-type:text/html;charset=utf-8");
Load('extend');
$this->ajax = $this->IS_AJAX;
$this->post = strtolower($_SERVER['REQUEST_METHOD']) == 'post';
$this->ip = get_client_ip();
$this->timestamp = time();
$this->root_path = dirname($_SERVER['PHP_SELF']);
$this->root_path = $this->root_path == '\\' || $this->root_path == '/' ? '' : $this->root_path;
define('__ROOT_PATH__', $this->root_path);
C('TMPL_PARSE_STRING.__ROOT_PATH__', __ROOT_PATH__);
$this->site_cfg = F('site_cfg');
$this->assign('site_cfg', $this->site_cfg);
define('__TPL_PATH__', '/Application/Home/View');
C('TMPL_PARSE_STRING.__TPL_PATH__', __TPL_PATH__);
$this->upload_dir = $this->root_path . '/upload/';
define('__UPLOAD_PATH__', $this->upload_dir);
C('TMPL_PARSE_STRING.__UPLOAD_PATH__', __UPLOAD_PATH__);
// 如果当前用户验证身份cookie有效则获取相用户信息
$_SESSION['auth'] = isset($_SESSION['auth']) ? $_SESSION['auth'] : '';
if ($_SESSION['auth'] != '' && $this->validAuthCookie()) {
C('formtoken_extra', $this->user['mid'] . $this->user['password']);
}
if (method_exists($this, '_init')) {
$this->_init();
}
}
示例10: updateVerify
public function updateVerify()
{
//verify配置文件源码
/*//验证码长度
'VERIFY_LENGTH' => '2',
//验证码图片宽度(像素)
'VERIFY_WIDTH' => '100',
//验证码图片高度(像素
'VERIFY_HEIGHT' => '35',
//验证码背影颜色(16进制色值
'VERIFY_BGCOLOR' => '#ffffff',
//验证码种子
'VERIFY_SEED' => '3456789aAbBcCdDeEfFgGhHjJkKmMnNpPqQrRsStTuUvVwWxXyY',
//验证码字体文件
'VERIFY_FONTFILE' => './Data/font.ttf',
//验证码字体大小
'VERIFY_SIZE' => '25',
//验证码字体颜色(16进制色值)
'VERIFY_COLOR' => '#444',
//SESSION识别名称
'VERIFY_NAME' => 'verify',
//存储验证码到SESSION时使用函数
'VERIFY_FUNC' => 'strtolower', */
if (F('verify', $_POST, CONF_PATH)) {
$this->SUCCESS('修改成功', U(GROUP_NAME . '/System/verify'));
} else {
$this->error('修改失败' . CONF_PATH . 'verify.php权限');
}
}
示例11: testBack
public function testBack()
{
$arrays = ['a', 'b', 'c', 'd'];
$expect = ['c', 'd'];
$actual = F()->back(2, $arrays)->call();
$this->assertEquals($expect, $actual);
}
示例12: edit
public function edit()
{
if (IS_POST) {
$db = D("Domains");
$data = $db->create();
if ($data) {
$status = $db->editDomains($data);
if ($status !== false) {
$this->success("编辑成功,请及时更新缓存!");
F("Domains_list", null);
} else {
$this->error("编辑失败!");
}
} else {
$this->error($db->getError());
}
} else {
$db = M("Domains");
$id = (int) $this->_get("id");
$info = $db->where(array("id" => $id))->find();
if (!$info) {
$this->error("该信息不存在!");
}
$this->assign($info);
$this->display();
}
}
示例13: __construct
function __construct($modelid, $id)
{
$this->modelid = $modelid;
$this->fields = F("Model_field_" . $modelid);
$this->id = $id;
load("@.treatfun");
}
示例14: testIfFalse
public function testIfFalse()
{
$person = (object) ['gender' => 'male'];
$expect = 'Woman';
$actual = F($person)->if(F()->gender->equalTo('male')->not(), F('Man'), F('Woman'))->call();
$this->assertEquals($expect, $actual);
}
示例15: _assign_oauth
/**
* 第三方登陆模块
*/
private function _assign_oauth()
{
if (false === ($oauth_list = F('oauth_list'))) {
$oauth_list = D('oauth')->oauth_cache();
}
$this->assign('oauth_list', $oauth_list);
}