PHP共26篇

thinkphp6.0 代码报错集 [收集各种报错解决方法]

thinkphp6.0 代码报错集 [收集各种报错解决方法]-趙哥博客-赵哥博客
报错代码:Call to undefined method think\Db::table() 解决方法:要引入文件use think\Facade\Db;
趙哥的头像-趙哥博客-赵哥博客趙哥2年前
023714

Thinkphp6 WorkerMan中如何向某个特定客户端发送数据

Thinkphp6 WorkerMan中如何向某个特定客户端发送数据-趙哥博客-赵哥博客
<?php declare (strict_types=1); namespace app\server; use think\worker\Server; use Workerman\Connection\TcpConnection; class index extends Server { protected $protocol = 'websoc...
趙哥的头像-趙哥博客-赵哥博客趙哥2年前
0116915

PHP 类型转换三种

PHP 类型转换三种-趙哥博客-赵哥博客
(int)、(integer):转换成整形 (float)、(double)、(real):转换成浮点型 (string):转换成字符串 (bool)、(boolean):转换成布尔类型 (array):转换成数组 (object):转换...
趙哥的头像-趙哥博客-赵哥博客趙哥2年前
017515

thinkphp6.0 Session

thinkphp6.0 Session-趙哥博客-赵哥博客
Session 是服务端存储,在使用 Session 之前,需要开启初始化,在中间件文件 middleware.php; // Session 初始化 \think\middleware\SessionInit::class TP6.0 不支持原生$_SESSION 的获取方式...
趙哥的头像-趙哥博客-赵哥博客趙哥2年前
040810

thinkphp5 命令行使用

thinkphp5 命令行使用-趙哥博客-赵哥博客
应用管理描述addon插件管理器build构建应用目录install安装 FastAdmin 控制器和模型描述make:controller创建新的资源控制器类make:model创建新的模型类 优化和缓存描述optimize:autoload优化 PS...
趙哥的头像-趙哥博客-赵哥博客趙哥1年前
03040

PHP 取中间文本

PHP 取中间文本-趙哥博客-赵哥博客
  function getSubstr($str, $leftStr, $rightStr) { $left = strpos($str, $leftStr); //echo '左边:'.$left; $right = strpos($str, $rightStr,$left); //echo '<br>右边:'.$right; i...
趙哥的头像-趙哥博客-赵哥博客趙哥2年前
02076

thinkphp6.0 cookie

thinkphp6.0 cookie-趙哥博客-赵哥博客
Cookie 是客户端存储,默认情况下是开启初始化的,在 config/cookie.php: ::set()方法,创建一个最基本的 cookie,可以设置前缀、过期时间、数组等; Cookie::set('user', 'Mr.Lee'); //临时保...
趙哥的头像-趙哥博客-赵哥博客趙哥2年前
052215

PHP getimagesize() read error 解决方法

PHP getimagesize() read error 解决方法-趙哥博客-赵哥博客
出现 'PHP Notice: getimagesize(): Read error' 错误通常表示 getimagesize() 函数无法从指定的文件中读取图像数据,因此无法获取图像的大小和类型信息。这个问题可能有几个不同的原因,下面列...
趙哥的头像-趙哥博客-赵哥博客趙哥1年前
02370

PHP获取公网ip

PHP获取公网ip-趙哥博客-赵哥博客
function getpublicip() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $cip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $cip = $_SERVER['HTTP_X_...
趙哥的头像-趙哥博客-赵哥博客趙哥2年前
03555

thinkphp6.0 缓存功能

thinkphp6.0 缓存功能-趙哥博客-赵哥博客
系统内置了很多类型的缓存,除了 File,其它均需要结合相关产品; 我们这里主要演示 File 文本缓存,其它的需要学习相关产品; 配置文件 cache.php 进行缓存配置,默认生成在 runtime/cache 目...
趙哥的头像-趙哥博客-赵哥博客趙哥2年前
07207