framework icon indicating copy to clipboard operation
framework copied to clipboard

ThinkPHP Framework

Results 260 framework issues
Sort by recently updated
recently updated
newest added

版本:6.0.9 PHP 版本 7.2.34 官方文档的实例是: ``` return [ [\app\http\middleware\Auth::class, 'admin'], 'Check', ['hello','thinkphp'], ]; ``` 但这么写的话,框架会报错,错误如下图: ![企业微信截图_20220905103400](https://user-images.githubusercontent.com/717699/188349897-67fe1fde-1a30-451a-a258-348e7a30b330.png) 文档是不是应该改成? ``` return [ [\app\http\middleware\Auth::class, ['admin']], 'Check', ['hello',['thinkphp']], ]; ```

如题,使用 LIKE 模糊查询,数据库中 Null 值查询不到,Thinkphp 查询条件中如何将数据库的空值转换为空字符串以查询出来? ![image](https://user-images.githubusercontent.com/45870098/188318623-17400f10-0e2a-4846-ae02-0ab1e973ffc2.png) ![image](https://user-images.githubusercontent.com/45870098/188318641-9ef7c043-0b03-4b29-a3eb-21a0b0ae40eb.png) ![image](https://user-images.githubusercontent.com/45870098/188318660-1f374c51-8ed1-4f5f-8663-6f53e87431d3.png)

我明明设置了config/session配置文件30天的超时,但是还是很快就超时了,感觉这个设置根本没生效 ``` return [ // session name 'name' => 'PHPSESSID', // SESSION_ID的提交变量,解决flash上传跨域 'var_session_id' => '', // 驱动方式 支持file cache 'type' => 'file', // 存储连接标识 当type使用cache的时候有效 'store' => null, // 过期时间...

手册中没有实现批量删除恢复的示例,使用: $newCustomers = CustomerModel::select($ids); $newCustomers->restore(); 报错: Call to undefined method think\\model\\Collection::restore() 使用 saveAll 更新 delete_time 为 null 无效。估计是框架过滤了。

使用Redis缓存TAG功能时, 如果设置了prefix, 会清除不了TAG本身 ```/** * 清除缓存 * @access public * @return bool */ public function clear(): bool { // 指定标签清除 foreach ($this->tag as $tag) { $names = $this->handler->getTagItems($tag); $this->handler->clearTag($names); //如果cache配置里设置了prefix,...

Cache

模型使用protected $dateFormat='Y-m-d H:i:s.u';方式,数据库的字段是timestamp,读取到的数据是 xxxx-xx-xx xx:xx:xx.000000这样的格式,后面的微妙显示全都是0

ORM

首先,我的配置文件 ``` // 数据库表前缀 'prefix' => 'd88_', ``` 在使用`hasManyThrough`的过程中 ```return $this->hasManyThrough(Role::class, ModelHasRole::class, 'user_id', 'id', $this->pk);``` ``` .... class ModelHasRole extends BaseModel { public $pk = 'role_id'; protected $table = 'model_has_role';...

ORM

在多应用模式下,Cache保存的位置为 `runtime/cache` , 在应用配置文件夹添加cache配置无效。

Cache

tp6 文档上写着:**在多应用模式下,默认文件缓存数据是区分不同应用的,如果你希望缓存跨应用,可以设置一个统一的数据缓存path目录。** 但实测发现 **tp6.1.1** : 在不同的应用之间设置的 cache('name', 'value') ,可以在不同的应用之间获取 cache('name'); 起初以为要设置应用级别的 cache.php 的 path 参数才会生效,但是设置后还是没有隔离。 所以多应用的 cache 默认是多应用不隔离?

Cache