• phpcms v9常用方法


    1.联动菜单根据地区id显示地区名称的方法:
     显示效果: 四川 >> 攀枝花 >> 仁和区 [字段名字为 area]
    {get_linkage($info['area'],1,'>> ',1)}
    2.根据类别typeid显示类别名称的方法:
    {php $TYPE = getcache('type_content','commons');}
     {$TYPE[$info[typeid]][name]}
    3.根据栏目catid显示栏目名称的方法:
    {php $CATEGORYS= getcache('category_content_'.$site,'commons');}
    {$CATEGORYS[$info[catid]][catname]}
    4.获取登录账号信息:
    $_username = param::get_cookie('_username');//当前登录人用户名
    $_userid = param::get_cookie('_userid');//当然登录人id
    $_nickname = param::get_cookie('_nickname');//当然登录人昵称
    5.获取缩略图:
    {thumb($Info['thumb'],$width,$height)}
    6.循环遍历标签:
    {loop $data $key $v}{$val[title]}{/loop}
    数据库操作函数:
    1、查询
    $this->select($where = '', $data = '*', $limit = '', $order = '', $group = '', $key='')   
    2、查询多条数据并分页
    listinfo($where = '', $order = '', $page = 1, $pagesize = 20, $key='', $setpages = 10,$urlrule = '',$array = array())
    3、获取单条记录查询  
    get_one($where = '', $data = '*', $order = '', $group = '')
    4、直接执行sql查询    
     query($sql);
    5、获取最后一次添加记录的主键号  
    insert_id()
    6、执行更新记录操作   
    update($data, $where = '')  //$data 建议为数组,$where 可为数组可为字符串
    7、执行删除记录操作   
    delete($where)
    8、计算记录数    
    count($where = '')
    9、获取最后数据库操作影响到的条数  
    affected_rows()
    10、获取数据表主键     
    get_primary()
    11、获取表字段    
     get_fields($table_name = '')
    12、检查表是否存在   
    table_exists($table)
    13、检查字段是否存在  
    field_exists($field)
  • 相关阅读:
    通过POST请求上传文件
    接口测试及常用接口测试工具
    maven-surefire-plugin插件
    BDD框架之Cucumber研究
    一分钟认识:Cucumber框架
    ACM团队周赛题解(3)
    C++11新增容器以及元组
    ACM团队周赛题解(2)
    C++11部分特性
    ACM团队周赛题解(1)
  • 原文地址:https://www.cnblogs.com/dreamydeng/p/5581399.html
Copyright © 2020-2023  润新知