dpxyfa4718 2010-12-01 17:18
浏览 36

如何生成显示多个类之间关系的数组?

I want a PHP script that scans PHP classes files in given directory(sub directories too) and generate relation ship between them in array form. suppose a folder that contains files and subdirectories( two subfolders).

| | |-class1.php
| | \-class2.php
| |-subdir1
| | |-class11.php
| | \-class22.php
| |-subdir2
| | \-class33.php

it contains total 5 files.

scanning files in directory is not big issue...but how can i deliver a class relationship between them.

i want array in this form.

array([0]=>classname=>class1,extends=>class2,implements=>[0]class11[1]class22,[1]=>classname=>class2,extends=>class33,implements=>NULL)

HINT: it can be done through reflection class.

can anyone help me?i need this script.. thanks

  • 写回答

1条回答 默认 最新

  • duan1979768678 2010-12-01 18:11
    关注

    Extract from all the files parts of code that look like class<something but not }>{<something perhaps containing nested {}>} and eval all of those pieces of code.

    I guess you will have to determine specific order in which to eval them (you might take a note which files include which to determine this order, or take a look at extends and implements)

    Then use reflection.

    评论

报告相同问题?

悬赏问题

  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决