[实践OK]使用PHP_UML生成代码的UML图---快速的看清整个代码的结构(类结构)。函数调用图,函数调用关系图。

jackxiang 2010-6-5 16:33 | |
•作者: laruence(http://www.laruence.com)
•本文地址: http://www.laruence.com/2010/05/14/1473.html
•转载请注明出处
在读别人代码的时候, 在没有详细文档的时候, 如何快速的看清整个代码的结构(类结构), 就成为了一个现实的问题.

今天我就介绍一种, 自动生成UML图的方法.
下载:http://pear.php.net/package/PHP_UML
假设, 我有一个项目文件夹:laruence, 在这个文件夹上有一个文件Root.php(事实上, 无论多级目录, 多个文件, 都可以).

<?php abstract class Root {
    private $instance;
    abstract public function Hi();
}
interface Intro {
    public function Say();
}
class Sub extends Root implements Intro {
    private $instance;
    public function Say() {
        echo "I am Laruence";
    }
    public function Hi() {
        echo "Hello!";
    }
}
?>




首先, 我们要使用PHP_UML(PHP_UML)根据代码生成XMI.

使用方法比较简单, 在安装PHP_UML以后, 运行:
pear安装PHP_UML命令的方法:/usr/local/php/bin/pear install PHP_UML-1.5.2
http://pear.php.net/package/PHP_UML/download
Linux下试安了下:
[root@test bin]# ./pear install PHP_UML-1.6.1
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
pear/PHP_UML requires PHP extension "XSL"
downloading Console_CommandLine-1.2.0.tgz ...
Starting to download Console_CommandLine-1.2.0.tgz (39,740 bytes)
..........done: 39,740 bytes
install ok: channel://pear.php.net/Console_CommandLine-1.2.0
上面说要更新pearl,于是:
[root@test bin]# pear channel-update pear.php.net
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded
继续:
/usr/local/php/bin/pear
pear/PHP_UML requires PHP extension "XSL"
No valid packages found
install failed
这段话的意思是“pear/PHP_UML需要php的扩展“XSL”,没有找到有效的软件包,安装失败。”
Windows:
extension=php_xsl.dll
Linux:
安装扩展xsl
找到安装包
find -name php-5.2.17*
进入安装包所在目录
如果是压缩的执行下边这条指令,已经解压缩的就跳过进入下一条指令
tar zxvf  php-5.2.17.tar.gz
cd php-5.2.17/ext/xsl
/usr/local/php_fcgi/bin/phpize
./configure --with-php-config=/usr/local/php_fcgi/bin/php-config
make
make install
出现提示
Installing shared extensions:     /usr/local/php_fcgi/lib/php/extensions/no-debug-non-zts-20060613/
然后在php_fcgi目录中的php.ini中增加一个注释extension = xsl.so就可以了,找到当时的源码目录,按上面操作也Ok。
后也就安装Ok了,如下:
[root@test bin]# ./pear install PHP_UML-1.6.1
downloading PHP_UML-1.6.1.tgz ...
Starting to download PHP_UML-1.6.1.tgz (518,959 bytes)
.........................................................................................................done: 518,959 bytes
install ok: channel://pear.php.net/PHP_UML-1.6.1
于是有这个文件了:/usr/local/php/bin/phpuml


phpuml laruence/ -o laruence.xmi -n laruence -f xmi  --pure-object --no-deployment-view  --no-component-view --no-docblocks

/usr/local/php/bin/phpuml  ./ -o myPro.xmi -n myPro -f xmi  --pure-object --no-deployment-view  --no-component-view --no-docblocks
-o directory                             Output directory path, or filename
-n name                                  Name of the generated UML model
-e encoding                              Output character encoding
-f php 输出的是挖空方法名里的代码,保留:变量,函数,注释。
-f format, --format=format               Output format: "xmi" (default),
                                           "html", "htmlnew", "php"
                                           For html/htmlnew/php, if you want to
                                           provide your own XMI file, pass it as
                                           argument to phpuml
-m pattern, --match=pattern              Patterns to match (default is: *.php)
-i pattern, --ignore=pattern             Patterns/pathnames to ignore
phpuml /var/www/test -o /tmp -x 1 -n Foo -m *.php6 -i .svn


实践Ok的注意点,变量注释及函数名注释[2014/2/15]:
加上 -e gbk 生成的xmi文件,其代码里的中文注释才能在Altova UModel生成的Html里以Utf8编码打开方式打开正常:
/usr/local/php/bin/php /usr/local/php/bin/phpuml  /data/htdocs/xiyou_alpha -e gbk -o /data/htdocs/tools.jackxiang.com/xiyou_php_uml/xiYouDomainUml.xmi -n xiYouDomainUml -f xmi  --pure-object --no-deployment-view  --no-component-view --no-docblocks

一、PHP先生成xmi,后经过Altova UModel导入再生成html。
常用。
二、直接用PHPUML生成Html,将生成Html文档(定期在Linux机器上生成):
http://lifei123.blog.51cto.com/2487662/435638
/usr/local/php/bin/php /usr/local/php/bin/phpuml  /data/htdocs/xiyou_alpha -e gbk  -o /data/htdocs/tools.xiyou.cntv.cn/xiyou_php_uml/uml2html -f html --pure-object --no-deployment-view --no-component-view --no-docblocks

三、其它工具:利用Enterprise Architect识别PHP输出UML图:
http://leeon.me/a/How-to-use-Enterprise-Architect-to-output-UML

四、还有一个工具可以生成调用图::Altova MapForce,这个工具可以支持XMI到UML图的转换
http://www.icultivator.com/p/6191.html


五、UML多做一点PHP代码少写一点: http://www.linxun.info/?p=270

我试试:--->下面这个猜想是不对的,这个玩意呀,是一个pear来安装的,于是你的安装pear后,再安装它才行
php phpuml D:\APMServ5.2.6\www\htdocs\soa\soa1.0  soa_uml_jackxiang.xmi -n laruence -f xmi  --pure-object --no-deployment-view  --no-component-view --no-docblocks


Error:
Fatal error: require_once(): Failed opening required 'Console/CommandLine.php' (
include_path='.;C:\php5\pear') in D:\APMServ5.2.6\www\htdocs\UML_TOOLS\PHP_UML-1
.5.2\scripts\phpuml on line 26

我随即下载了一个张宴的apm,经过后面的安装,我们才能得到正确的结果,following me ,ok:

会得到一个laruence.xmi文件, phpuml的具体参数可以通过phpuml –help了解.

有了xmi以后, 如何转成UML图呢?

Visio2007不支持导入XMI, 我找到了另外的一个工具:Altova Umodel(我下载了一个:2010破解版本的,发现用不了,看膘哥一篇文章:http://www.neatstudio.com/show-1280-1.shtml  用的是这个Altova MapForce,下载地址:https://shop.altova.com/pricelist.asp), 这个工具可以支持XMI到UML图的转换, 需要注册, 不过提供了30天的使用许可(大家要是有更好的替换方案, 欢迎补充).
华军软件园也有下载,我南方网通,网通下载较快:http://www.newhua.com/softdown/94173_2.htm

DownLoad: http://soft2.jdxz.net/down/Altova%20UModel%20Enterprise%202010%20v12.0%20%D3%A2%CE%C4%B0%E6.rar?2101486036745x1275809647x2101486777479-7b2c187951d3b18f487f3f72eda0eeeb   2010 破解版本网上都有的:)

使用方法:导入和生成
1.File -》Import From XMI File
2.Project-》Generate Documentation  (可选 :生成HTML和Word的Doc文档)

在Umodel导入laruence.xmi以后 ,生成UML图, 就得到了如下的PNG:
点击在新窗口中浏览此图片


是不是很方便呢?

另外PHP_UML还可以生成html格式, 做为一种doc gen工具也不错. 更可以通过xmi生成PHP文件.


安装pear的可能出现的情况:
-------------------------

进入php目录,直接运行pear.bat,因为目录下有这个文件。但是告诉我不对,所以我准备重装pear,怎么装呢?官方告诉我,下载一个go-pear.php文件,用PHP执行一下就可以了。

下载好go-pear.php文件后,拷到php目录下,运行:php go-pear.php,然后就一步一步的往下安装PEAR了。装的时候请选择system而不是local。安装完毕后生成一个REG文件,这是让你执行一下,把PHP的环境变量加到系统中。


这时候,就可以运行pear install PHP_UML-1.5.2了,第一件郁闷的事情就发生了,系统提示,php_uml需要xsl的支持,因为我用的是绿色版的,所以我修改了一下我的php.ini后,继续执行时,仍然提示需要xsl,不是特别明白的时候,我看了一下我的php.ini,确认是加载了。但再次运行又是提示,最后我运行php --ini,才发现,原来命令行下用的php.ini居然是在c:\windows下面,而不是我绿色版中配置的php.ini文件。我把php.ini拷贝到c:\windows下后,程序可以顺利执行,安装完毕php_uml了。


第二件郁闷的事情接踵而至,按照上文的程序方式,我生成了xmi文件,却发现无法打开,怎么办?按照 文件提示下载了那个Altova MapForce

php -d output_buffering=0 PEAR\go-pear.phar



D:\APMServ5.2.6\PHP>php -d output_buffering=0 PEAR\go-pear.phar

Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : local
Please confirm local copy by typing 'yes' :

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

1. Installation base ($prefix)                   : D:\APMServ5.2.6\PHP
2. Temporary directory for processing            : D:\APMServ5.2.6\PHP\tmp
3. Temporary directory for downloads             : D:\APMServ5.2.6\PHP\tmp
4. Binaries directory                            : D:\APMServ5.2.6\PHP
5. PHP code directory ($php_dir)                 : D:\APMServ5.2.6\PHP\pear
6. Documentation directory                       : D:\APMServ5.2.6\PHP\docs
7. Data directory                                : D:\APMServ5.2.6\PHP\data
8. User-modifiable configuration files directory : D:\APMServ5.2.6\PHP\cfg
9. Public Web Files directory                    : D:\APMServ5.2.6\PHP\www
10. Tests directory                               : D:\APMServ5.2.6\PHP\tests
11. Name of configuration file                    : C:\Windows\pear.ini
12. Path to CLI php.exe                           : D:\APMServ5.2.6\PHP

1-12, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\Windows\pear.ini...
Initialized registry...
Preparing to install...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.2.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.7.1.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar...
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
install ok: channel://pear.php.net/Archive_Tar-1.3.2
install ok: channel://pear.php.net/Console_Getopt-1.2.3
install ok: channel://pear.php.net/Structures_Graph-1.0.2
install ok: channel://pear.php.net/PEAR-1.7.1
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

******************************************************************************
WARNING!  The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<D:\APMServ5.2.6\PHP\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.


Would you like to alter php.ini <D:\APMServ5.2.6\PHP\php.ini>? [Y/n] : y

php.ini <D:\APMServ5.2.6\PHP\php.ini> include_path updated.

Current include path           : .;C:\php5\pear
Configured directory           : D:\APMServ5.2.6\PHP\pear
Currently used php.ini (guess) : D:\APMServ5.2.6\PHP\php.ini
Press Enter to continue:

** WARNING! Old version found at D:\APMServ5.2.6\PHP, please remove it or be sure to use the new d:\apmserv5.2.6\php\pear.bat command

The 'pear' command is now at your service at d:\apmserv5.2.6\php\pear.bat


* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under D:\APMServ5.2.6\PHP\PEAR_ENV.reg .
This file creates ENV variables for the current user.

Double-click this file to add it to the current user registry.


D:\APMServ5.2.6\PHP>pear install PHP_UML-1.5.2

Warning: Invalid argument supplied for foreach() in PEAR\Downloader.php on line 555

Warning: Invalid argument supplied for foreach() in D:\APMServ5.2.6\PHP\PEAR\PEAR\Downloader.php on line 555
downloading PHP_UML-1.5.2.tgz ...
Starting to download PHP_UML-1.5.2.tgz (503,404 bytes)
..................................


在张宴的默认安装目录: D:\APMServ5.2.6\www\htdocs
建立目录:\laruence  ,目录下建立:laruence.php  
cmd下:
cd D:\APMServ5.2.6\www\htdocs
运行命令:

D:\APMServ5.2.6\www\htdocs>phpuml laruence/ -o laruence.xmi -n laruence -f xmi  --pure-object --no-deployment-view  --no-component-view --no-docblocks


运行结束后,在目录:D:\APMServ5.2.6\www\htdocs
下,你可以看到生成了一个:laruence.xmi 文件,大功告成!!!
随后,你可以按照风雪说的,搞个破解版本的Altova Umodel 2010,我google看有并下载了一个,呵呵,感觉不错。


代码审查查,得再用一次:
先下载:http://pear.php.net/package/PHP_UML  后解压,然后运行时提示如下:
PHP Warning:  require_once(PHP/UML.php): failed to open stream: No such file or directory ...
PHP Fatal error:  require_once(): Failed opening required 'PHP/UML.php'
原来是找不到文件:
require_once 'Console/CommandLine.php';
require_once 'PHP/UML.php';
这两行的问题,于是解决方法如下:
1)建立PHP目录,把下载的文件放里面。
2)构造PHP的PATH路径,如下:

如果你换一个位置:define("LIB_PATH","/home/jackxiang/PHPUML/"); 目录得换,或者写成相对的。
然后再次执行:

我执行这个Ok生成:

下载后的验证码URL:http://jackxiang.com/post/4627/
使用方法:导入和生成
1.File -》Import From XMI File
2.Project-》Generate Documentation  (可选 :生成HTML和Word的Doc文档)

这个哥们的博客也写吧,觉得生成html这块还不错,如下:
URL:http://lifei123.blog.51cto.com/2487662/435638
一般的使用方法是:
phpuml 项目目录 -o 项目名.xmi -n 项目名 -f xmi --pure-object --no-deployment-view --no-component-view --no-docblocks
得到的文件是xmi格式的,需要使用软件进行转换,经过尝试,StarUML可以转(需要注意的是StarUML、ArgoUML只支持PHP_UML的XMI格式1.0,而不支持2.0,因此需要在命令行中加入-x 1.0)。 也可以使用
phpuml 项目目录 -o 项目名.xmi -n 项目名 -f html --pure-object --no-deployment-view --no-component-view --no-docblocks
实例:



/root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php

PHP Warning:  chdir(): Not a directory (errno 20) in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 129
PHP Fatal error:  Class 'XSLTProcessor' not found in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 133

查询Google,有人为此提交了一个Bug,URL:http://pear.php.net/bugs/bug.php?id=16924&edit=3
最后,提示是没有安装扩展,PHP_UML depends on the PHP module "XSL".dl("php_libxslt.so");

Description:
------------
When I run the cli version I´ll get a Fatal error

Using this command
phpuml /var/www/htdocs/project -f html -o /var/www/UML/

Get this respons
Fatal error: Class 'XSLTProcessor' not found in /usr/local/lib/php/PHP/UML/Output/ExporterXSL.php on line 133


-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: baptiste
Hello,

PHP_UML depends on the PHP module "XSL".
It seems that this module is not enabled in your configuration.
To enable it, remove the ";" in the line ";extension=php_xsl.dll" in your php.ini

Linux下安装:
php_libxslt - a simple libxslt PHP/XSL extension
Overview ::
php_libxslt is a very simple PHP extension to transform XML documents using the GNOME XSLT C library. It provides an alternative XSLT engine to the current PHP default XSL extension. It currently seems to work fine (and serves this site since more than 2 years), but there's (as always) room for improvements. There's e.g. no serious error handling implemented yet (any volunteers?).
php_libxslt has been tested using PHP4.1.2/libxslt 1.0.16 on Linux/PowerPC (Debian/woody), PHP4.2.3/libxslt 1.0.16 on Linux/i386 (Debian) and PHP4.3.1 on Linux/i386 (RedHat), test reports (success/failure) especially regarding platforms different from Linux are welcome, contact axelm-php(at)nona.net.
Download ::
Note: The file below is rather small (about 15kB), so the download may be finished within just a few seconds. Note well: Retrying doesn't increase the file's size ;).
Source code: php_libxslt-0.3.0.tar.gz Here:  http://nona.net/download/php_libxslt-0.3.0.tar.gz
md5sum: 08e896ccc06c5c79d47e90de646e07c0
Installation ::
Please refer to the file INSTALL in the tarball if you are installing from source, or to the dpkg man page if you are using the Debian packages. For building the Debian packages from the source tarball please refer to INSTALL.Debian.
Usage ::
php_libxslt has a very simple interface (as it provides just one function). A few examples are provided in the "examples" directory of the distribution. Simply transforming XML using an XSL stylesheet is done by calling:
<?
   dl("php_libxslt.so");
   $transformed = libxslt_transform($xmlstring, $xsltstring);
?>

first argument: XML string to be transformed (no file name, the XML document itself)
second argument: XSL stylesheet string (again, no file name, stylesheet itself required)
return value: Transformation output (if transformation did succeed) or XML input document (if transformation did fail).
Adding XSLT parameters ::
If you want to hand over parameters to your stylesheet, call the function with the (optional) third argument containing the XSL parameters in a hash:
<?
   dl("php_libxslt.so");
   $xslparam['ExampleParameter'] = "'Example Value'";
   $xslparam['OtherParameter'] = "'Another Value'";
   $transformed = libxslt_transform($xmlstring,
                       $xsltstring, $xslparam);
?>

(Be careful regarging quoting of the parameter strings, unquoted parameters will be interpreted by libxslt)
Error handling ::
If, for any reason, the XSL transformation does not succeed, the original XML string is returned. Detailed error messages should show up in your web servers error log.
Questions? Feedback? ::
Feel free to contact me at axelm-php(at)nona.net. Feedback, comments, questions and build/bug reports are welcome.

以上来源:http://nona.net/software/phplibxslt/
<?php
//$xml = new DomDocument;
//$xml->load('test.xml');
$xsl = new DomDocument;
//$xsl->load('test.xsl');
$xslt = new Xsltprocessor;
//$xslt->importStylesheet($xsl);
//$transformation = $xslt->transformToXml($xml);
//echo $transformation;
?>

PHP Fatal error:  Class 'Xsltprocessor' not found in /root/software/php_libxslt-0.3.0/test.php on line 8
https://bugs.php.net/bug.php?id=37969&edit=1  
如果你在php5中用xslt_create()这个php4中的方法时,将会得到call    to    undefined    function    xslt_create()这个error。
reason is : 该扩展已经从    PHP    5    中移出,然后移入到    PECL    仓库中。 php5的ext目录下已经没有php_xslt.dll了,取而代之的是php_xsl.dll。
phpinfo();没有找到。
用下面代码探测:
<?php
if(extension_loaded("xsl")) {
    if(class_exists("XSLTProcessor")) {
        trigger_error("XSL loaded and ready", E_USER_NOTICE);
    }  
    else {
        trigger_error("XSL extension loaded but class could not be found", E_USER_ERROR);
    }          
}              
else {          
    trigger_error("XSL extension has not been loaded", E_USER_ERROR);
}                

root@116.255.139.240:/data0/htdocs/blog# php xsl.php
PHP Fatal error:  XSL extension has not been loaded in /data0/htdocs/blog/xsl.php on line 11
果然没有!!!

root@116.255.139.240:~/software/php-5.3.8/ext/xsl# phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
./
root@116.255.139.240:~/software/php-5.3.8/ext/xsl# ./configure
checking for XSL support... yes, shared
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

oot@116.255.139.240:~/software/php-5.3.8/ext/xsl# rpm -qa libxslt
libxslt-1.1.17-2.el5_2.2
whereis xslt-config
然后./configure --help 看看--with-xsl指定他的详细路径。
找到他的位置:
root@116.255.139.240:/# rpm -ql libxslt-1.1.17-2.el5_2.2|grep xslt-config
root@116.255.139.240:/#
在URL:http://www.hackbase.com/tech/2011-09-09/65235.html 找到:
错误二十
  configure:error:xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
  解决方法:
  #yum install libxslt libxslt-devel
如下:
Running Transaction
  Installing     : libgpg-error-devel                                                                                           1/3
  Installing     : libgcrypt-devel                                                                                              2/3
  Installing     : libxslt-devel                                                                                                3/3

Installed:
  libxslt-devel.i386 0:1.1.17-2.el5_2.2                                                                                            
Dependency Installed:
  libgcrypt-devel.i386 0:1.4.4-5.el5                                 libgpg-error-devel.i386 0:1.4-2                                
Complete!

再编译:
Build complete.
Don't forget to run 'make test'. 通过了,原来就没有安装: libxslt-devel,xslt-config在 libxslt-devel这个包里面,确定如下:
root@116.255.139.240:~/software/php-5.3.8/ext/xsl# rpm -ql libxslt-devel-1.1.17-2.el5_2.2|grep  xslt-config
/usr/bin/xslt-config
root@116.255.139.240:~/software/php-5.3.8/ext/xsl# make install
Installing shared extensions:     /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/
root@116.255.139.240:~/software/php-5.3.8/ext/xsl# ls  /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/
eaccelerator.so  imagick.so  memcache.so  pdo_mysql.so  soap.a  soap.so  ssh2.so  syck.so  xdebug.so  xsl.so
xsl.so加入PHP.ini中即可。

最后,生成Html就Ok了:





mkdir /tmp/html
chmod -R 777 /tmp/html
php ./phpuml /home/jackxiang/public_html/adc/web_adc_proj/trunk -o /tmp/html -n adcGenOutHtml -f html  --pure-object --no-deployment-view  --no-component-view --no-docblocks

?root@116.255.139.240:/tmp/html# ls
inherit.gif  style.css

php ./phpuml --help
Options:
  -o directory                             Output directory path, or filename
                                           (if not provided, the XMI code is
                                           printed on screen)
  -f format, --format=format               Output format: "xmi" (default),
                                           "html", "htmlnew", "php"
                                           For html/htmlnew/php, if you want to
                                           provide your own XMI file, pass it as
                                           argument to phpuml
  -x XMI version                           XMI version to generate (1 or 2)
  -n name                                  Name of the generated UML model
生成了xmi1.0的,但是用它来给Altova UModel解析,出现错误:

对比:
强行生成xmi1.0的导入:
... finished XMI import - 7 error(s), 1 warning(s)
默认生成的xmi导入:
... finished XMI import - 0 error(s), 7180 warning(s)




PHP Warning:  DOMDocument::loadXML(): Entity 'bull' not defined in Entity, line: 1665 in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 68
PHP Warning:  DOMDocument::loadXML(): Entity 'deg' not defined in Entity, line: 1665 in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 68
PHP Warning:  DOMDocument::loadXML(): Entity 'dagger' not defined in Entity, line: 1665 in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 68
PHP Warning:  DOMDocument::loadXML(): Entity 'Dagger' not defined in Entity, line: 1665 in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 68
PHP Warning:  DOMDocument::loadXML(): Entity 'plusmn' not defined in Entity, line: 1665 in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 68
PHP Warning:  DOMDocument::loadXML(): Entity 'permil' not defined in Entity, line: 1665 in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 68
PHP Warning:  DOMDocument::loadXML(): Entity 'trade' not defined in Entity, line: 1665 in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 68
PHP Warning:  DOMDocument::loadXML(): Entity 'micro' not defined in Entity, line: 1665 in /root/software/PHP_UML-1.5.5/PHP/UML/Output/ExporterXSL.php on line 68



PHP生成html结尾的文件实践Ok及感悟:
Use the option -f to specify which format you want phpuml to generate.
$ phpuml /var/www/foo -f html -o /var/tmp/

This will scan /var/www/foo, and create the API documentation in /var/tmp/.
If you need to provide your own XMI file (instead of parsing existing PHP files), simply pass it as argument.
$ phpuml myFile.xmi -f php -o /var/tmp/
This will read the XMI code contained in myFile.xmi, and generate the PHP code templates in /var/tmp/.
下面我是测试Ok的,一个是由xmi转回为PHP文件,第二个是把PHP文件转为Html的类继承图:


还可以忽略某些目录的扫描,扫描规定某后缀文件名,等等,昨天晚上搞了很晚,最后找到文档
唯有文档,只有文档才是最好的参考,什么书啊,博客啊,都是部分,或者有失真,所以贴上其
PHPUML文档的URL:
http://pear.php.net/manual/en/package.php.php-uml.command-line.php

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/3147/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2017-9-11 09:40
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]