thinkphp5 unique自动验证账号已存在,数据表默认主键是id
thinkphp5 使用unique自动验证账号是否已存在,好像数据表默认主键必须是id
如果主键不是id,会提示错误SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list'
解决办法,可以自定义主键id
...
Thinkphp5清除runtime下的cache缓存,temp缓存,log缓存
Thinkphp5清除runtime下的cache缓存,temp缓存,log缓存
/**
* 清除缓存
*/
public function clearCache(){
\think\facade\Cache::clear();
return ZHTReturn('清除成功',1);
}
/...
thinkphp5.1 env
$path = env();
dump($path);
array(11) {
["THINK_PATH"] => string(26) "D:\www\WWW\maiqi\thinkphp\"
["ROOT_PATH"] => string(17) "D:\www\WWW\maiqi\"
["APP_PATH"...
thinkphp5.1 关闭日志log和日志设置
打开文件config\log.php
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------...
thinkphp5.1中使用缓存和清除缓存
使用缓存
public function pageQuery(){
$rs = cache('role');
if(!$rs){
$key = input('key');
$where[] = ['status','=',1];
if($key != '')$where[] = ['roleTitle','...
thinkphp5.1 allowField(true)无效不管用
thinkphp版本5.1.40 LTS
表单提交的数据为
$data['id'] = 8;
$data['roleTitle'] = '123';
$data['roleDesc'] = 'abc';
其中id数据表中不存在,所以需要过滤
但是
$rs = $this->allowField(true...
Thinkphp5.1自定义分页样式
第一步、添加分页配置
在config目录下新建一个paginate.php配置文件,代码如下:
<?php
// +----------------------------------------------------------------------
// |分页设置
// +-----------------------...
thinkphp5 paginate.php配置不管用
thinkphp5自定义分页样式,
在配置文件夹config里面,新建paginate.php配置文件(不知道为什么默认不存在),
但总是不成功,配置文件不起作用
如果直接写到model里面,是可以的
$list = Db::name('user')->where('status',1)->pagin...
thinkphp5模板布局能否指定某一个页面不显示该模板布局layout?
两种方式
1.在控制器里对应的方法里
$this->view->engine->layout(false);// 前提是你继承了Controller
namespace app\index\controller;
use think\Controller;
class User extends Control...
thinkphp5 Class 'app\admin\controller\Request' not found
加上use think\facade\Request;就可以了
完整代码
<?php
namespace app\admin\controller;
use think\facade\Request;
/**
* 首页控制器
*/
class Index extends Base
{
/**
* ...
thinkphp group by count如何同时使用?分页用到
分页前,需要获取记录条数
$count = M('abc')->where($where)->count();
但是, 如果查询还需要使用到 GROUP BY的话
$count = M('video_log')->where($where)->group('ip')->count();
...
thinkphp 提示Class 'think\Db' not found
明明有use think\Db;
还是提示Class 'think\Db' not found
$list= Db::table('m_my_reserve_assess')
->alias('mra')
->field('mra.id,mra.insert_ti...
thinkphp Class 'Manage\Controller\Db' not found
thinkphp Class 'Manage\Controller\Db' not found
加上use think\Db;就可以了
代码如下:
<?php
namespace Manage\Controller;
use think\Db;
class VideoLogController extends ...
解决宝塔Warning: require(): open_basedir restriction in effect
处理完之后,一定要重启php服务
thinkphp部署在宝塔上,提示
Warning: require(): open_basedir restriction in effect
直接修改网站设置,网站目录里的防跨站攻击,取消打勾,重启网站就正常了。
thinkphp5报错 Call to a member function toArray() on array
thinkphp5内报错Call to a member function toArray() on array
使用场景
使用模型查询后,想获取不包含对象内容的数组结构的结果。
使用方式
$gardenAuth ...
onebase后台系统设置,如果网站关键字和网站描述是同样文字的话,导致网站描述修改失败
onebase后台【系统管理>系统设置】,如果网站关键字和网站描述是同样文字的话,导致网站描述修改失败。
很奇怪的问题,如果关键字和描述文字相同,关键字修改成功,描述却失败了,如下图
追踪数据修改过程,我们发现是因为foreach调用save方法,导致的问题,如果两个字段$name的值$value相同,则第...
关于本站
“最难不过坚持”
本人承接扒站仿站,php网站维护,病毒查杀,网站编辑,网站改版,html制作
有需要网站维护,改版,病毒查杀,网站编辑,网站备案,html制作等相关的工作可以联系我。
本人有多年相关工作经验,也可提供免费咨询,交个朋友。
有需要探讨问题的朋友,也可以加我微信,共同探讨!
微信:15011482830 QQ:408917339
2683
39
分类目录
最新评论
- https://jueru.net/
-
- :weixiao:
-
- :shuijiao: :weiqu: :zhenbang: :leng:
-
- :yiwen: :yiwen: :yiwen: :yiwen:
-
- 这个业务逻辑多少都有点奇怪了,阅读浏览次数增值在新闻详情页的控制器方法里setInc,这怎么还写进模型事件里了。如果非要用onAfterRead也可以,把新闻文章的内容单独分出来一个news_content表,然后把它和news做关联,然后给news_content表的onAfterRead事件做增值处理,这样点进新闻页内查询到文章内容时才会触发它。
-
文章标签更多