随笔分类 - hyperf
hyperf
摘要:安装hyperf/websocket-server组件 composer require hyperf/websocket-server websocket服务配置 config/autoload/server.php <?php declare(strict_types=1); use Hyper
阅读全文
摘要:UDPServer类 app/Server/UdpServer.php <?php declare(strict_types=1); namespace App\Server; use Hyperf\Contract\OnPacketInterface; class UdpServer implem
阅读全文
摘要:TcpServer类 app/Server/TcpServer.php <?php declare(strict_types=1); namespace App\Server; use Hyperf\Contract\OnReceiveInterface; class TcpServer imple
阅读全文
摘要:访问器 Index控制器 app/Controller/IndexController.php <?php namespace App\Controller; use Hyperf\HttpServer\Contract\RequestInterface; use Hyperf\HttpServer
阅读全文
摘要:安装模型缓存组件 composer require hyperf/model-cache 控制器 app/Controller/IndexController.php <?php namespace App\Controller; use Hyperf\HttpServer\Contract\Req
阅读全文
摘要:sql执行日志 控制器 app/Controller/IndexController.php <?php namespace App\Controller; use Hyperf\HttpServer\Annotation\AutoController; use App\Model\User; /*
阅读全文
摘要:查询构造器分页 控制器 app/Controller/IndexController.php <?php namespace App\Controller; use Hyperf\HttpServer\Annotation\AutoController; use Hyperf\DbConnectio
阅读全文
摘要:一对一 控制器 app/Controller/IndexController.php <?php namespace App\Controller; use Hyperf\HttpServer\Annotation\AutoController; use App\Model\User; /** *
阅读全文
摘要:生成model php bin/hyperf.php gen:model user User model app/Model/User.php <?php declare (strict_types=1); namespace App\Model; use Hyperf\DbConnection\M
阅读全文
摘要:查询 查询 use Hyperf\DbConnection\Db; $users = Db::select('SELECT * FROM user;'); $users = Db::table('user')->get(); $users = Db::table('user')->select('n
阅读全文
摘要:安装数据库组件 composer require hyperf/db-connection 数据库配置 <?php declare(strict_types=1); return [ 'default' => [ 'driver' => env('DB_DRIVER', 'mysql'), 'hos
阅读全文
摘要:安装filesystem composer require hyperf/filesystem 生成filesystem配置文件 config/autoload/file.php php bin/hyperf.php vendor:publish hyperf/filesystem 控制器 app/
阅读全文
摘要:安装session组件 composer require hyperf/session 生成session配置文件 config/autoload/session.php php bin/hyperf.php vendor:publish hyperf/session <?php declare(s
阅读全文
摘要:安装validation composer require hyperf/validation 安装translation composer require hyperf/translation 生成translation配置文件 php bin/hyperf.php vendor:publish
阅读全文
摘要:安装视图 composer require hyperf/view 安装 Smarty 引擎 composer require smarty/smarty 安装task composer require hyperf/task 控制器 app/Controller/ViewController.ph
阅读全文
摘要:查看命令列表 php bin/hyperf.php 启动hyperf服务 php bin/hyperf.php start 生成控制器 php bin/hyperf.php gen:Controller UserController 添加注解 use Hyperf\HttpServer\Annota
阅读全文
摘要:安装 composer require hyperf/paginator paginator控制器 app/Controller/PaginatorController.php <?php namespace App\Controller; use Hyperf\HttpServer\Annotat
阅读全文
摘要:配置 config/autoload/logger.php <?php declare(strict_types=1); return [ 'default' => [ 'handler' => [ 'class' => Monolog\Handler\StreamHandler::class, '
阅读全文
摘要:Cache代理类 Cache代理类 app/Utils/Cache.php <?php namespace App\Utils; use Hyperf\Utils\ApplicationContext; use Psr\SimpleCache\CacheInterface; class Cache
阅读全文
摘要:控制器 app/Controller/IndexController.php <?php namespace App\Controller; use Hyperf\HttpServer\Annotation\AutoController; use App\Exception\FooException
阅读全文