//检测域名
protectedstaticfunctionparseDomain(&$url,$domain)
{//根据url及传入的域名进行解析
if(!$domain){//如果没有传入合适的数据,直接返回
return‘‘;
}
$request=Request::instance();//请求实例化
if(true===$domain){//如果传入的域名为true则自动判定域名
//..
分类:
Web程序 时间:
2016-12-15 18:26:06
阅读次数:
209
namespacethink;
usethink\Config;
usethink\Loader;
usethink\Request;
usethink\Route;
//使用think里面,内置的ConfigLoaderRequestRoute
classUrl
{
//生成URL地址的root
protectedstatic$root;//根地址
/**
*URL生成支持路由反射
*@paramstring$url路由地址
*@paramstr..
分类:
Web程序 时间:
2016-12-14 10:01:19
阅读次数:
279
TODO:macOS上ThinkPHP5和Semantic-UI集成1.全局安装(onOSXviahomebrew)Composer是homebrew-php项目的一部分2.把Xcode升级到8.1后继续安装Composer3.使用composer创建TP5项目MWL-Dispatchcomposercreate-projecttopthink/thinkMWL-Dispatch4.配置apache,设置Virtualhosts,在h..
分类:
Web程序 时间:
2016-12-13 16:54:18
阅读次数:
446
/**
*预载入关联查询返回模型对象
*@accesspublic
*@paramModel$result数据对象
*@paramstring$relation关联名
*@returnModel
*/
publicfunctioneagerlyResult($result,$relation)
{
return$this->relation()->eagerlyResult($result,$relation);
}//提前载入关联查询
/..
分类:
Web程序 时间:
2016-12-13 16:53:37
阅读次数:
293
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