* [ ] 浏览器输出文件内容
```
Response::SendData($FileData, $Format = null);
```
FilePlace(string|array):内容
Format (string|bool):格式=显示,文件名=下载
*****
输出验证码例,自动加上mime
```
$data = Frame::ObStart(function () use ($int) {
self::ImgCode();
});
Response::SendData($data, 'jpg');
```
验证码下载例,自动加上mime
```
$data = Frame::ObStart(function () use ($int) {
self::ImgCode();
});
Response::SendData($data, 'code.jpg');
```
输出验证码,自定义mime
```
$data = Frame::ObStart(function () use ($int) {
self::ImgCode();
});
Response::SendData([$data,'image/jpeg']);
```
下载验证码,自定义mime
```
$data = Frame::ObStart(function () use ($int) {
self::ImgCode();
});
Response::SendData([$data,'image/jpeg'],'code.jpg');
```
```
private static function ImgCode($num = 5, $codes = 'code_name', $w = 60, $h = 20, $str = '') {
$str = !empty ($str) ? $str
: 'abcdefghkmnprstuvwxyzABCDEFGHKMNPRSTUVWXYZ23456789';
$code = '';
for ($i = 0; $i < $num; $i++) {
$code .= $str [mt_rand(0, strlen($str) - 1)];
}
$im = imagecreate($w, $h);
$_bg = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, $w, $h, $_bg);
$gray = imagecolorallocate($im, 204, 213, 204);
imagerectangle($im, 0, 0, $w - 1, $h - 1, $gray);
$rand_ = imagecolorallocate($im, 204, 213, 204);
for ($i = 0; $i < 80; $i++) {
imagesetpixel($im, rand(0, $w), rand(0, $h), $rand_);
}
$black = imagecolorallocate($im, 0, 0, 204);
$_str = ($w - 40) / 2;
for ($i = 0; $i < $num; $i++) {
imagestring($im, 5, $_str, ($h - 16) / 2, substr($code, $i, 1),
$black);
$_str += 10;
}
imagepng($im);
imagedestroy($im);
}
```
- 开始使用
- 配置文件
- 路由模式
- AutoLoad类
- 启动文件
- __construct
- SetRouting
- SetAlias
- SetStop
- SetError
- Access
- SetWorker
- SetClassFile
- SetClassDir
- Run
- OpenLoad
- LinuxStartAll
- Session类
- 使用说明
- set
- get
- delete
- pull
- has
- id
- Cookie类
- 使用说明
- set
- get
- delete
- pull
- has
- TempLets类
- 模板语法
- 模板标签
- html
- show
- assign
- obtain
- Request类
- get
- post
- host
- referer
- getip
- localip
- header
- body
- file
- scheme
- protocolversion
- uri
- path
- querystring
- method
- Response
- SendFile
- FileStream
- SendData
- SetStatus
- SetHead
- SetMime
- WebSend
- redirect
- dumpJson
- dump
- come
- ps
- Frame类
- GetWeb
- ViewFile
- RoutingData
- SetClassFile
- SetClassDir
- GetMime
- FileMime
- LoadDir
- StartDir
- IsJson
- ArrJson
- JsonFormat
- ObStart
- GetConfig
- ConfigDir
- TempDir
- GetRunData
- GetStatic
- IsDebug
- SetDebug
- GetDebugInfo
- GlobalVariables类
- 使用说明
- set
- get
- delete
- pull
- has
- id
- Mysql类
- 新版本
- 第三方
- Thinkorm
- Medoo
- 旧版本
- Mysql 配置格式
- 项目中操作数据库
- 项目场景
- 项目数据库配置
- 项目数据库中间类
- 项目中操作数据表
- 连贯操作
- where
- table
- data
- order
- field
- limit
- page
- group
- having
- join
- tabname
- union
- sql
- link
- link_base
- lock
- CURD 操作
- 写入数据
- 数据删除
- 数据查询
- 数据更新
- 数据统计操作
- count
- sum
- max
- min
- avg
- 操作DEMO
- CurdTrait.php
- 项目Model层操作表.md
- Curl类
- Method类
- SslAes类
- layui_zqadmin