thinkphp5 自动写入数据库 datetime
发表于|更新于|php
1 | protected $autoWriteTimestamp = 'datetime'; |
文章作者: developer
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Dev!
相关推荐
2018-02-01
thinkphp5 缓存 补充使用方法
thinkphp5 文档当中大致有缓存的使用方法,但是比较简略,很多时候难以应对实际工作以下给出缓存的实际用法 使用默认配置时,直接调用cache方法即可 自定义配置12config('cache.path', config('cache_path'));self::$cache = Cache::connect(config('cache')); 应该使用connect方法重新获取缓存实例,并在使用后恢复原来配置
2017-04-02
thinkphp5 phpstudy 显示 No input file specified 解决办法
这是由于运行模式导致的修改入口处的配置 12345678910111213<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f #apacheHanlder模式 #RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] #fastCGI模式 RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]</IfModule>
2017-08-28
thinkphp5 tp5 子查询 join
123456$GLOBALS["queryid"] = $id;$res = Db::name("cfamily_post")->where("delete_time", 0)->where('id', 'in', function ($query){ $query->name("cfamily_category_post")->where('category_id', $GLOBALS["queryid"])->field('post_id');})->page($page, $listRows)->select(); 123456789$join = [ ["cfamily_category_post relation","post.id = relation.post_id"],];...
2018-01-24
thinkphp5 模型初始化 注意要点
参考文献https://www.kancloud.cn/manual/thinkphp5/177529 TP中模型初始化 使用initialize方法否则会导致无法正常使用模型的对象特性 例如读取后数据为空空数组
2017-12-04
thinkphp5 tp5 开启url 兼容模式 方法
thinkcmf 使用thinkphp5开发 虽然号称支持url兼容模式 1index.php?s=a/b/c 实际上没法打开的 需要做如下修改 入口文件修改12$base_url = '/test/thinkcmf/public/';\think\Url::root($GLOBALS["base_url"] . 'index.php?s='); HomeBaseController AdminBaseController修改1$root = empty($GLOBALS["base_url"]) ? cmf_get_root() : $GLOBALS["base_url"]; 登陆控制器修改这时屏蔽验证码 或者修改验证码生成的地方即可
2017-08-29
thinkphp5 多对多关联模型
可能是为了卖文档tp5的文档过于简单我想很多人可能确实应该转去laravel了 经过实践可知tp5模型有如下特性 实例化内部可以用方法访问关联,使用前应该有读取一行的操作,以便让主键有值,自动写入中间表 1$this->categories()->save($category); 外部需要用属性的方式去读取,不支持select,只能是find或者取出select后的一条数据 1$posts[0]->categories->column('id');
公告
This is my Blog