现在,越来越多的企业和组织开始在他们的局域网里部署企业Wiki,其中不乏一些著名公司如Adobe System,英特尔(Intel),微软(Miscrosoft),印弗瑟斯(Infosys),甚至美国联邦调查局(FBI)。根据组织的大小不同,企业Wiki被广泛用以改善或者替换传统僵硬的集中式内容管理系统(CMS),因为相比之下基于Wiki的内容管理系统可以更加开放、灵活而且高效,它使得员工得以从根本上迅速、高效并低成本地在企业内部交换有用信息。
在目前的实践中,企业Wiki还被主要用于:
建立公司、部门或者团队的知识库或者内部CMS平台;
协助项目管理如跟踪任务状态(比如Streber软件);
创建并保持更新产品文档或手册;
减少企业内部电子邮件流量
集中式的信息发布,协同办公。
部门和团队建设内容发布。
我们android会调用php编写的接口,那么版本会很多,便于后期维护的话,就要写文档便于客户端开发能及时查看。但是传统的文档就要去编写,要经常维护就很麻烦。那么我们接下来通过PHP自动生产wiki格式的要求,不用开发来维护了。下面直接上代码:
function readWikiFile() {
$basePath = Common::getConfig('siteConfig', 'logPath');
$apiDir = $basePath.'/Api';
$filesnames = scandir($apiDir);
print_r ($filesnames);
$apiNames = array(
'Api_xxx' => array('apiName'=>'登陆**','version'=>'1.1.2'),
'Api_xxx' => array('apiName'=>'活动**','version'=>'1.6.4'),
......
);
$fileKeys = array(
'Api_Account'=>'我的账号',
'Api_Activity'=>'活动管理',
......
);
$files = array();
foreach ($fileKeys as $keyword=>$title) {
foreach ($filesnames as $name) {
if($name == '.' || $name == '..'){
continue;
}
if(substr_count($name, $keyword)){
$files[$keyword][] = array(
'fileName' => $name,
'title' => $title
);
}
}
}
print_r($files);
$wikiFileName ="gameHallWiki.wiki";
$fileContent='';
foreach ($files as $k=>$v) {
foreach ($v as $k1=>$v1) {
if($k1 == 0){
$fileContent.='=='.$v1['title'].'==';
}
$filePath = $basePath . 'Api/'.$v1['fileName'];
$oneApiFile ='';
$oneApiFile = file_get_contents($filePath);
$oneApiFile = repalceFile($apiNames, $v1['fileName'], $oneApiFile);
$fileContent.= $oneApiFile;
}
}
filePut($wikiFileName, $fileContent, true);
}
function repalceFile($apiNames, $oneApiName, $oneApiFile){
foreach($apiNames as $key=>$value){
if($key == $oneApiName){
$replaceApiName = substr($oneApiName, 4);
$oneApiFile = str_replace($replaceApiName, $value['apiName'], $oneApiFile);
$oneApiFile = str_replace('1.x.x', $value['version'], $oneApiFile);
return $oneApiFile;
}
}
return $oneApiFile;
}
function filePut($fileName, $fileContent, $init=false){
$filePath = Common::getConfig('siteConfig', 'logPath') . 'Api/'.$fileName;
if($init){
unlink($filePath);
}
file_put_contents($filePath, $fileContent, FILE_APPEND);
}
readWikiFile();
这样就直接生成wiki格式了不用再去维护,避免经常修改文档带来的麻烦!!
我们android会调用php编写的接口,那么版本会很多,便于后期维护的话,就要写文档便于客户端开发能及时查看。但是传统的文档就要去编写,要经常维护就很麻烦。那么我们接下来通过PHP自动生产wiki格式的要求,不用开发来维护了。下面直接上代码:
function readWikiFile() {
$basePath = Common::getConfig('siteConfig', 'logPath');
$apiDir = $basePath.'/Api';
$filesnames = scandir($apiDir);
print_r ($filesnames);
$apiNames = array(
'Api_xxx' => array('apiName'=>'登陆**','version'=>'1.1.2'),
'Api_xxx' => array('apiName'=>'活动**','version'=>'1.6.4'),
......
);
$fileKeys = array(
'Api_Account'=>'我的账号',
'Api_Activity'=>'活动管理',
......
);
$files = array();
foreach ($fileKeys as $keyword=>$title) {
foreach ($filesnames as $name) {
if($name == '.' || $name == '..'){
continue;
}
if(substr_count($name, $keyword)){
$files[$keyword][] = array(
'fileName' => $name,
'title' => $title
);
}
}
}
print_r($files);
$wikiFileName ="gameHallWiki.wiki";
$fileContent='';
foreach ($files as $k=>$v) {
foreach ($v as $k1=>$v1) {
if($k1 == 0){
$fileContent.='=='.$v1['title'].'==';
}
$filePath = $basePath . 'Api/'.$v1['fileName'];
$oneApiFile ='';
$oneApiFile = file_get_contents($filePath);
$oneApiFile = repalceFile($apiNames, $v1['fileName'], $oneApiFile);
$fileContent.= $oneApiFile;
}
}
filePut($wikiFileName, $fileContent, true);
}
function repalceFile($apiNames, $oneApiName, $oneApiFile){
foreach($apiNames as $key=>$value){
if($key == $oneApiName){
$replaceApiName = substr($oneApiName, 4);
$oneApiFile = str_replace($replaceApiName, $value['apiName'], $oneApiFile);
$oneApiFile = str_replace('1.x.x', $value['version'], $oneApiFile);
return $oneApiFile;
}
}
return $oneApiFile;
}
function filePut($fileName, $fileContent, $init=false){
$filePath = Common::getConfig('siteConfig', 'logPath') . 'Api/'.$fileName;
if($init){
unlink($filePath);
}
file_put_contents($filePath, $fileContent, FILE_APPEND);
}
readWikiFile();
这样就直接生成wiki格式了不用再去维护,避免经常修改文档带来的麻烦!!