php胡乱笔记

来源:互联网 发布:天书世界太极5升6数据 编辑:程序博客网 时间:2024/04/30 02:05
strtotime();//2012-12-12 12:12:12 字符串转化为时间floor — 舍去法取整ceil — 进一法取整alter table dm_items_user add foreign key(items_id) references dm_items(id);//添加外键var_dump(C("SESSION_AUTO_START"));//session默认开启<?php/*在html中使用的函数*/mt_rand(100,1000) 输出随机数?>//  cmd 连接数据库  mysql -u root -<p></p><?phppreg_match_all(pattern, subject, matches)//正则表达式匹配?><?php/*数据库操作*/$count=M('hd_user')->count();//数据表行数echo $user->getLastSql();  //输出最后的sql执行结果M("hd_wish")->data->add()$wish=M("wish")->select();$list = $User->where('status=1')->order('create_time')->limit(10)->select();$user=M("user")->where(array('username'=>$username))->find();//数据库更新$item=M("dm_items")->where("id=".I("id"))->setInc(I('title'));//更新dm_items数据表M("user")->save($data);//id相当于一个where语句  更新数据库?><?php /*thinkphp库函数*/F()//没有时间概念的缓存F("phiz",$phiz,"./Data/")//将字符串$phiz写入当前目录下Data文件夹内 文件名是phiz.phpF("phiz","","./Data/")//读出$id=get_client_ip();//得到ipsession("uid",$user["id"]);//存入session$this->redirect("admin/Index/index");//跳转?>kindeditor,ueditor  富文本编辑器<?phpClass WishAction extends Action{    Public function index(){        $this->display();    }//index 控制器的 index项目}?><?php/*操控json来的数据*/      $backValue=array();     $backValue[0]=$_POST['aa'];         $backValue[1]=$_POST['bb'];      echo json_encode($backValue[0]);header('Content-type: text/html; charset=utf8');?><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />echo I('username','','htmlspecialchars');  //将特殊字符转换为html实体    U('./index/handle')  //URL定位       gt  >       lt <    eq=    M('wish')->where('array(id=>array('gt','0'))')->delete();            <foreach name="wish" item="v">        <tr>            <td>                ID:{$v.id}            </td>            <td>                内容:{$v.content}            </td>            <td>                姓名:{$v.username}            </td>            <td>                时间:{$v.time|date='y-m-d h:i:s',###}            </td>        </tr>        </foreach>         <form action="{:U('handle')}" method="post" name="wish">配置文件        <?phpreturn array(    //'配置项'=>'配置值'    'TMPL_TEMPLATE_x'=>'.htm',    'URL_HTML_SUFFIX'=>'HTML',    'URL_MODEL'=>1,    'DEFAULT_FILTER'=>'htmlspecialchars',    'URL_CASE_INSENSITIVE'  => true,//大小是否区别    //数据库配置信息        'DB_TYPE'   => 'mysql', // 数据库类型        'DB_HOST'   => 'localhost', // 服务器地址        'DB_NAME'   => 'test', // 数据库名        'DB_USER'   => 'root', // 用户名        'DB_PWD'    => '123456', // 密码        'DB_PORT'   => 3306, // 端口        'DB_PREFIX' => '', // 数据库表前缀         //其他项目配置参数       'TEMP_VAR_IDENTIFY'=>'array',    );?>dump($array);//将数组递归分开
0 0