学习路之PHP--webman安装及使用
学习路之PHP--webman安装及使用
- 一、安装webman
- 二、运行
- 三、安装webman/admin
- 四、效果
- 五、使用
一、安装webman
- 准备:
PHP >= 8.1
Composer >= 2.0
启用函数:
putenv
proc_open
pcntl_signal_dispatch
pcntl_signal
pcntl_alarm
pcntl_fork
pcntl_wait
shell_exec
exec
- 安装命令
composer create-project workerman/webman:~2.0
二、运行
php start.php start
浏览器访问 http://ip地址:8787
三、安装webman/admin
- 安装扩展
fileinfo - 运行安装
如果是webman是1.x版本执行 composer require -W webman/admin ~1.0
如果是webman是2.x版本执行 composer require -W webman/admin ~2.0
- 访问
http://127.0.0.1:8787/app/admin/ 完成数据库相关配置
四、效果
五、使用
- 忘记密码之处理方法
plugin\admin\app\controller\AccountController.php 61行
public function login(Request $request): Response{$this->checkDatabaseAvailable();$captcha = $request->post('captcha', '');if (strtolower($captcha) !== session('captcha-login')) {return $this->json(1, '验证码错误');}$request->session()->forget('captcha-login');$username = $request->post('username', '');$password = $request->post('password', '');// return $this->json(1,password_hash($password, PASSWORD_DEFAULT));//忘记密码之处理方法:直接输出密码密文
- 简化验证码
plugin\admin\app\controller\AccountController.php 196行
public function captcha(Request $request, string $type = 'login'): Response{$builder = new PhraseBuilder(4, '2345678');//abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ //简化验证码