• thinkphp小技巧


    if(IS_POST) _404("页面不存在",U("index"))               //如果不是POST提交,则跳转到index。debug模式中不跳转,显示string。

    if(IS_POST) halt("页面不存在")                                 //更详细的错误信息,页面可定制

    M(表名)->data($data)->add()                                  //向数据库添加数据

    M(表名)->where(array('id'=>array('gt',0)))->delete()    //删除id>0    where是必须条件

    $this->success("成功",U("index"))                             //成功执行,并跳转

    $this->error("失败")                                                   //失败执行,并跳转。默认跳转回提交页面

    {$v.time | date='y-m-s H-i', ###}                               //web页面中显示,并且格式化时间

    F('filename',$filedata,'/dir/')                                        //将数据$filedata存入路径dir下,文件名是filename

    $this->ajaxReturn(array('status'=>0),'json')                      //常用返回

     addslashes($arr)                                                             //string  转义

    ini_get("session.gc_maxlifetime")                                         //取得参数

    在html中<script>中使用thinkphp模板{}定义变量 然后可供js使用

    <css  file="../name.css"/>     <js  file="name.js" />                                                     新型引用标签

    {... $v['id']...}                                                                      //再模版中使用时,需要使用原生数组取值,不能直接$v.id

  • 相关阅读:
    MobileNet V1 V2
    异常检测 与 One Class SVM
    异常检测
    图像分割
    1x1卷积核的作用
    迁移学习
    python
    图像分割
    图像分割
    Nagios
  • 原文地址:https://www.cnblogs.com/olenji/p/4862661.html
Copyright © 2020-2023  润新知