最近项目需要phpdoc生成文档,首先安装phpDocumentor,利用pear安装:
切换用户:

su root

安装PhpDocumentor:

pear install PhpDocumentor

生成文档:

phpdoc -o HTML:frames:earthli -d CustomService/ -t docs/

    浏览生成文档结果很让我失望,程序中中文乱码,后google搜索得知,PhpDocumentor的默认编码是:iso-8859-1的,我的项目都是utf8编码的,所以需要把编码改成utf-8才可以。
进入PhpDocumentor的模板目录把模板文件修改成utf-8编码:

cd /usr/share/php/data/PhpDocumentor/phpDocumentor/Converters/

执行字符串查找并替换命令:

find ./ -name '*.tpl' | xargs sed -i 's/iso-8859-1/utf-8/g'

    执行完毕之后再生成项目文档,浏览项目中中文乱码解决。
以后如果项目换了别的编码,也可以用此命令修改过去。

相关文章:

  • 2021-11-20
  • 2022-02-07
  • 2021-10-08
  • 2021-12-02
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
猜你喜欢
  • 2021-06-10
  • 2021-05-09
  • 2021-07-12
  • 2021-12-05
  • 2021-12-01
  • 2022-03-04
  • 2021-07-12
相关资源
相似解决方案