php胡乱笔记

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>

<?php
preg_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.php
F("phiz","","./Data/")//读出
$id=get_client_ip();//得到ip
session("uid",$user["id"]);//存入session
$this->redirect("admin/Index/index");//跳转
?>

kindeditor,ueditor  富文本编辑器
<?php
Class 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">
配置文件
        <?php
return 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);//将数组递归分开
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值