
thinkphp
qq_24100549
这个作者很懒,什么都没留下…
展开
-
php 按照分辨率压缩图片到指定kb
<?phpnamespace img;/** * 图片压缩类:通过缩放来压缩。如果要保持源图比例,把参数$percent保持为1即可。 * 即使原比例压缩,也可大幅度缩小。数码相机4M图片。也可以缩为700KB左右。如果缩小比例,则体积会更小。 * 结果:可保存、可直接显示。 */class Img{ private $src; private $image; private $imageinfo; private $percent = 0.5;转载 2022-04-25 14:40:52 · 861 阅读 · 0 评论 -
路由是什么
路由广义上就是映射关系原创 2022-03-18 14:48:12 · 236 阅读 · 0 评论 -
fastadmin 导出文件
fastadmin 导出大文件 添加set_time_limit(0);@ini_set(‘memory_limit’, -1);原创 2021-11-20 11:18:11 · 819 阅读 · 0 评论 -
tp5.0安装 workerman和运行 websocket
第一步:cmd 到项目根目录运行1 :composer require topthink/think-worker=1.0.* -vvvwindows下需要运行(tp5手册:https://www.kancloud.cn/manual/thinkphp5/235128)2: composer require workerman/workerman-for-win第二步public 目录新建server .php文件define(‘APP_PATH’, DIR . ‘/…/application/原创 2021-07-08 14:58:50 · 627 阅读 · 0 评论 -
ThinkPHP5.0的助手函数汇总
```phpload_trait:快速导入Traits,PHP5.5以上无需调用/** * 快速导入Traits PHP5.5以上无需调用 * @param string $class trait库 * @param string $ext 类库后缀 * @return boolean */load_trait($class, $ext = EXT)exception:抛出异常处理/** * 抛出异常处理 * @param string $msg 异常消息 *.原创 2021-06-30 14:54:00 · 267 阅读 · 2 评论 -
依赖注入的理解
//\app\common\Temp $temp 触发依赖注入 public function getMothod(\app\common\Temp $temp){ //\app\common\Temp $temp等价于 //$temp =new \app\common\Temp; $temp->setName('学习tp5.1'); echo $temp->getName(); }...原创 2021-04-19 16:06:55 · 79 阅读 · 0 评论 -
php 中trait类实现代码复用
trait Demo1{ public function test1(){ return __METHOD__; }}trait Demo2{ public function test2(){ return __METHOD__; }}class Demo{ use Demo1,Demo2; public function test(){ return __METHOD__; }}$obj =原创 2021-04-19 13:27:34 · 97 阅读 · 0 评论 -
tp5配置项获取与设置
一、设置获取(use think\facade\Config;)Config::get();Config::set();Config:has();二、助手函数(不依赖与config类)config(); dump(config('database.username'));1:config::has('database.username')同config('?database.username');2:Config::set();同config('database.usernam原创 2021-04-02 16:31:04 · 505 阅读 · 0 评论 -
tp下载地址
https://www.jsdaima.com/blog/163.html原创 2021-03-08 18:29:20 · 319 阅读 · 0 评论 -
安装tp6时出现Could not find package topthink/think with stability stable.
安装tp6.0操作步骤:1. git bash到要安装的地方 2. 执行命令: composer create-project topthink/think tp6出现的错误:[InvalidArgumentException]Could not find package topthink/think with stability stable.解决方案:删除之前的镜像:composer config -g --unset repos.packagist结果:报错解决,可以正常安装tp转载 2021-03-08 17:19:35 · 754 阅读 · 0 评论