TODO:macOS上ThinkPHP5和Semantic-UI集成 1. 全局安装 (on OSX via homebrew)Composer 是 homebrew-php 项目的一部分 2. 把Xcode升级到8.1后继续安装Composer 3. 使用composer创建TP5项目MWL-Di ...
分类:
Web程序 时间:
2016-12-13 07:39:59
阅读次数:
254
/**
*删除记录
*@accesspublic
*@parammixed$data主键列表支持闭包查询条件
*@returninteger成功删除的记录数
*/
publicstaticfunctiondestroy($data)//删除记录
{
$model=newstatic();//获取继承者ID
$query=$model->db();//获取数据库操作
if(is_array($data)&&ke..
分类:
Web程序 时间:
2016-12-12 15:33:47
阅读次数:
241
/**
*分析查询表达式
*@accesspublic
*@parammixed$data主键列表或者查询条件(闭包)
*@paramstring$with关联预查询
*@parambool$cache是否缓存
*@returnQuery
*/
protectedstaticfunctionparseQuery(&$data,$with,$cache)//解析sql表达式
{
$result=self::with($with)-&g..
分类:
Web程序 时间:
2016-12-11 10:33:44
阅读次数:
260
/**
*设置允许写入的字段
*@accesspublic
*@parambool|array$field允许写入的字段如果为true只允许写入数据表字段
*@return$this
*/
publicfunctionallowField($field)
{//关于数据库的操作,设置许可字段
if(true===$field){//如果字段为true
$field=$this->db()->getTa..
分类:
Web程序 时间:
2016-12-09 10:44:12
阅读次数:
276
/**
*设置需要追加的输出属性
*@accesspublic
*@paramarray$append属性列表
*@return$this
*/
publicfunctionappend($append=[])
{
$this->append=$append;//属性追加
return$this;
}
/**
*设置需要隐藏的输出属性
*@accesspublic
*@paramarray$hidden属性列表
*@return$th..
分类:
Web程序 时间:
2016-12-08 12:11:15
阅读次数:
284
/**
*自动写入时间戳
*@accesspublic
*@paramstring$name时间戳字段
*@returnmixed
*/
protectedfunctionautoWriteTimestamp($name)
{//自动写入时间戳
if(isset($this->type[$name])){//如果当期时间戳字段拥有类型
$type=$this->type[$name];//获取当前字段时间类型
if..
分类:
Web程序 时间:
2016-12-07 14:48:38
阅读次数:
240
单独在模型里面设置:(推荐) 在config中添加全局设置: 如果数据表字段不是默认值(假设数据库字段名为create_at和update_at) ...
分类:
其他好文 时间:
2016-12-07 13:16:52
阅读次数:
340
/**
*设置数据对象值
*@accesspublic
*@parammixed$data数据或者属性名
*@parammixed$value值
*@return$this
*/
publicfunctiondata($data,$value=null)
{//设置数据对象值
if(is_string($data)){//is_string($data)
$this->data[$data]=$value;//实现了可以对数据的keyvalu..
分类:
Web程序 时间:
2016-12-06 11:37:39
阅读次数:
190
<?php
//+----------------------------------------------------------------------
//|ThinkPHP[WECANDOITJUSTTHINK]
//+----------------------------------------------------------------------
//|Copyright(c)2006~2016http://thinkphp.cnAllrightsreserved.
//+----..
分类:
Web程序 时间:
2016-12-05 10:01:02
阅读次数:
362
<?php
//+----------------------------------------------------------------------
//|ThinkPHP[WECANDOITJUSTTHINK]
//+----------------------------------------------------------------------
//|Copyright(c)2006~2016http://thinkphp.cnAllrightsreserved.
//+----..
分类:
Web程序 时间:
2016-12-02 16:45:19
阅读次数:
289