What is PhpXref ?
2 j6 c8 V* |7 O% h; d* F, O7 H' oPHPXref (PHP Cross Referencing Documentation Generator),为一种开发文档生成工具,用于处理包含大量 PHP 文件的项目,为 PHP 源代码增加交叉参考,快速地为显示的 PHP 源代码添加书签链接,使得浏览源代码变得方便快速。其工作原理是遍历项目目录,将 PHP 文件的源代码翻译成可读性很强的 HTML 文件,同时加上注释,生成的结果为 HTML 文件,可使用任何浏览器进行浏览。运行只需安装 Perl 即可。
# T1 N" }6 w7 H
8 M* B& q2 N3 ^& ]这个在没有CVS
服务器或Sub Version的环境下,phpXref不失为一个好的发布php代码,文档同步的好工具
7 r; F; Z$ F( B' K% m
' n/ B7 N8 ?4 @2 g2 U' K" hPhpXref Features
, S7 G$ s+ d3 j$ F6 J3 x- Y& y r Q7 ^7 m. Y2 C2 ]& P1 U; i
快速,方便,需求简单
# `* J/ V8 q& o2 [+ k5 ^/ A
不用任何
web服务器就可以输出,
9 [( i' u) d4 z8 t* R$ K
完全匹配php的函数,classes,变量,常量,并支持包含文件
& y3 C" d) x n: k0 y+ S
JS的特性,支持跳转,搜索,历史
/ e0 w: @1 R& O" q高亮,代码提示,鼠标效果
9 Y& I2 k4 L. |# L6 e完美的打印效果
: U6 |1 v( t; J- ~3 e6 [1 O4 D跨平台,从linux,*nix,win32无缝兼容.
& R8 L( o+ R* w! T9 D. m$ g4 W4 O
/ j# Z4 g, I2 s/ MHow Get PhpXref ?& z( A' \- Y& l" S+ X3 Y# J) G
) L1 _, z' ~( p! h9 R* w
you can visit web site: http://phpxref.sourceforge.net/
4 f5 [2 g& A, t0 b+ r你可以从那获取到linux,win32的版本,
) v2 ?* E9 D, |/ U; W
当然默认有需要perl
解析器的支援,你也可以选择编译后exe的版本.
) `) v3 i: u+ r s/ ~# X. B
% K/ r. V: n7 A! ]How Use PhpXref ?
) d9 m) t( P. g+ O你首先到官方网站下载最新版本的PhpXref ,这里拿win32的版本做个说明,
k2 U) E! G) B% H7 W: F下载回来后,解压到任何目录,
# [8 V l6 [" \
" O$ N. U* l* W9 I r3 y
将你要产生 cross reference 的 code 复制到 source 内
0 o( J8 v' @ i* `
0 q7 e: |* w# s1 t; `0 |9 v) y8 r6 [然后用编辑器打开phpxref.cfg ,
9 n' h, X* B0 w1 z" f
修改第10行的 SOURCE=source 你的code所在的目录,
- @; c& l1 U) o% d' q
修改第14行的 OUTPUT=output 你的code输出的目录,
+ h7 a) O- R+ A; v0 R
17行为工程的命名ROJECT=Unnamed Project v0.00
1 t/ {5 b) Y9 }
26行为cross reference 默认的头部 HEADERFILE=sample_header.html
! k; `; |/ s, p
将编码修改为你需要的编码,
4 p: b/ C4 {. X6 J* `1 V$ J9 O" J* k& P
_; U/ Z. M. m) Z2 v3 l" I m
保存phpxref.cfg
9 g- D$ l6 \ d2 g% T$ @' q
% H* w- d& o/ d( Z
直接运行phpxref.exe,剩下的结果就是等待了.
复制内容到剪贴板
代码:
PHPXref 0.6
(c) Gareth Watts 2004
Processing..
Source............: /tmp/phpxref-0.3/source
Target............: /tmp/phpxref-0.3/output
Scanning Tree.....: ....................................................................
Generating Output.: ....................................................................
Generating variable references: .......
Generating function references: .....
Generating class references: .
Generating table references:
Summary statistics:
Files Scanned: 68
62 variable names in 120 definitions and 507 references.
49 function/method names in 28 definitions and 349 references.
1 class names in 2 definitions and 6 references.
0 table names in 0 references.
Done.发布,你将output的文档复制到任何web目录下,
4 h- z$ z% X7 Z# A d你可以用http://yoursite.com/output 看到php cross reference 的结果
/ [3 E: u q L6 L- r. W1 p8 O M$ f7 Y4 c# d
Some Demo !
$ j# P; U- C* _# \: u; o
( ^' \' e+ g, I( d. o% \! f& T: z很多开源工程都设立了phpXref的镜像,
- j# ^+ g z5 n' b
这里推荐几个,
1 ~* z3 @ f" j' e
2 n- m3 R) X5 @3 o3 c/ @" h3 a
# w# z3 ~, m- t5 y0 v/ K; t! T
Xoops cms系统 : http://xoopsforge.com/ref/language/schinese/user.php.source.html
# W+ m& r1 f& f& E7 {' A! A1 A7 cwordpress blog系统: http://cenamayo.com/wpxref/
4 `, |' P% P$ LTikiwiki : http://de.tikiwiki.org/xref-BRANCH-1-9/lang/sk/language.php.source.html
4 {# d2 @3 i2 o& y; M% A/ Q
DokuWiki : http://dev.splitbrain.org/reference/dokuwiki/nav.html?_variables/index.html
% U) R9 a& s C( E2 C' j" ^9 `* }
著名的开源论坛phpbb : http://www.phpbb.de/doku/xref/nav.html?index.html
( i& E; P+ ?3 A- [. d$ @3 K7 Z5 w3 H8 r! A9 T
遗憾的是大陆的php开发团队,目前偶还没看到任何使用PhpXref 文档镜像的站点.
8 x2 k4 h: f E" H* c
在台湾的一些技术网站看到了部分的使用..