[TOC]
## 帮助文档
- 帮助文档对于开发者来说是非常重要的
- 编写文档虽然不难,但比较繁琐
- 文档和代码一般不会放一起,看起来比较分散,真的要看文档也不容易找到
## TPHP帮助文档说明
- 可参考本帮助文档路径: /html/plugins/tphp/demo/help
- 测试帮助文档路径: /html/plugins/tphp/test/help
- 文档路径为插件主目录的help目录
- 翻页快捷键: ctrl + 上下左右方向键
- 菜单级联层数不限
- 文件夹和文件不区分大小写
- 比如 title 和 TITLE 文件效果是一样的
- 本文档通用网址地址,在所有项目内都是可以打开的
- 1、 [http://plu.tphp.com/help/plugins/tphp/help](http://plu.tphp.com/help/plugins/tphp/help)
- 2、 [http://help.tphp.com/help/plugins/tphp/help](http://help.tphp.com/help/plugins/tphp/help)
- 3、 [http://md.tphp.com/help/plugins/tphp/help](http://md.tphp.com/help/plugins/tphp/help)
设置文件/html/plugins/tphp/test/config/domains.php内容如下
```
<?php
return [
'md' => [
// 目录指向 /html/plugins/tphp/test/help
// 等同于: 'help' => 'tphp.test'
'help' => ':',
// 图标指向: /html/plugins/tphp/test/static/favicon.ico
'icon' => ':favicon.ico',
// 调试页面,方便上传图片, 默认false
// 'debug' => true,
// 当tphp.test不存在时直接输出系统404错误, 默认false
'404' => true,
// 所有的页面都会调用
// 和/html/plugins/tphp/test/help/call文件配置效果一样
// domains.php配置的call优先级高于/html/plugins/tphp/test/help/call文件配置
// 'call' => function($info){
// dump($info);
// }
],
];
```
设置文件/html/plugins/tphp/test/help/01_first/title内容如下
```
第一节
```
设置文件/html/plugins/tphp/test/help/01_first/DEScription内容如下
```
第一章描述
```
设置文件/html/plugins/tphp/test/help/01_first/keywordS内容如下
```
第一章关键词
```
设置文件/html/plugins/tphp/test/help/02_two/title内容如下
```
第二节
```
设置文件/html/plugins/tphp/test/help/03_three/title内容如下
```
第三节隐藏了哦
```
设置文件/html/plugins/tphp/test/help/03_three/Hide内容如下
设置文件/html/plugins/tphp/test/help/call内容如下
```
#test:run
```
设置文件/html/plugins/tphp/test/help/Title内容如下
```
测试文档
```
设置文件/html/plugins/tphp/test/help/footer内容如下
```
<span>设则有</span>, <span>不设则无</span>
```
设置文件/html/plugins/tphp/test/help/keywords内容如下
```
顶部关键词
```
设置文件/html/plugins/tphp/test/help/description内容如下
```
顶部描述
```
设置文件/html/plugins/tphp/test/help/01_first/ReadMe.md内容如下

打开网址[http://md.tphp.com](http://md.tphp.com)获得如下效果
或者打开网址[http://plu.tphp.com/help/plugins/tphp/test](http://plu.tphp.com/help/plugins/tphp/test)(效果一样)

- 可以看到第三节被隐藏了
- footer不设置时页脚就没有了
再来看下SEO源码


再来看下SEO源码

## 全局函数调用 call
- domains.php 中的 call 配置 (优先使用)
- 根目录中的call文件/html/plugins/tphp/test/help/call
- 把根目录中的call前面的#删除即:test:run
- /html/plugins/tphp/test/help/01_first/ReadMe.md 中有引用call.php文件
设置文件/html/plugins/tphp/test/base/test/call.php内容如下
```
<?php
return new class {
public $plu;
public function index($str = '')
{
return "Index: {$str}";
}
public function info($str = '', $str2 = '')
{
return "Info: {$str} {$str2}";
}
public function run($info = null)
{
// 传递基本信息
// dump($info);
// 修改body颜色
$this->plu->style("body {background-color: #FEE}");
// 或加载对应的css文件
// $this->plu->css("...");
}
};
```
可以看到背景颜色发生了变化
- 要把帮助文档装饰成啥样都可以
- 可以做一些帮助文档插件等等

#### 头部和底部html
设置文件/html/plugins/tphp/test/help/head内容如下
```
<div style="display:none;">头部数据</div>
```
设置文件/html/plugins/tphp/test/help/body内容如下
```
<div style="display:none;">底部数据</div>
```


## 上传图片
- 必须打开debug才能使用,设置domains.php中的 'debug' => true
- 提供了三种上传方式
- 1、点击上传
- 2、图片拖拽
- 3、ctrl + v 粘贴上传 (IE不支持)
- 除插件目录图片外所有上传图片都会保存到public目录中
- \_\_SATIC__ 字符串会自动转化为当前插件的static目录
