zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    序列操作
    random模块
    windows系统杀掉explorer.exe进程后黑屏
    Apache + SVN: Could not open the requested SVN filesystem
    使用ps命令批量删除相关进程
    'pybot.bat'不是内部或外部命令,也不是可运行的程序
    安装wxpython的时候报错 “no installation of python 2.7 found in registy”
    wxPython 使用Dialog实现模态对话框
    Python os.system()出现乱码
    Git操作reset --hard失误
  • 原文地址:https://www.cnblogs.com/dreamydeng/p/5581399.html
Copyright © 2011-2022 走看看