如何在大型实时运行的 Web 系统中找到正确的 php 文件进行编辑?
我有一个正在运行的巨大网站,但存在很多问题。这是由世界各地的许多程序员开发的。所以如果我想修复一些错误,真的很难找到它在哪里等等......这些文件位于 zend 框架中。有数百个php文件,css文件,java sripts文件等。有什么方法可以全局搜索文件或如何理解这种大型系统的文件链接?
I have a huge live running web site wich has lot of issues. This has developed by lot of programmers around the world. So If I want to fix some errors its really hard to find where it is and so on....These files are in zend framework. There are 100s of php files, css files java sripts files, etc. Is there any way that I can do global search a file or how to understand the file linkage of this kind of large systems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您使用 Linux,有很多方法可以找到正确的文件 -
在命令行
按名称查找文件 -
或者更快地按名称查找文件 -
递归搜索目录内容以查找string -
这是我最近学到的一个新技巧 - 使用 Ack!如果您使用的是 Debian/Ubuntu 系统,您可以通过执行以下操作来安装 ack -
然后您可以执行 -
这速度非常快!
在 IDE 中
在大多数 IDE 或高级编辑器中,您应该能够简单地通过控制单击或右键单击并选择“转到定义”来导航到函数的定义。
我可以证明这适用于 Netbeans、Eclipse、Komodo、Emacs 等。
如果您愿意采用新的 IDE,我建议使用 Netbeans。它的 PHP 模式充满了好处,包括改进的导航。例如,要快速打开文件,您只需执行 Alt-Shift-O 并键入文件名即可。
If you are using Linux there are a bunch of ways to find the correct file -
On the command line
Find a file by name -
Or the faster find a file by name -
Search a directory's contents recursively for a string -
Here's a new trick I learnt recently - Using Ack! If you are on a Debian/Ubuntu system you can install ack by doing -
Then you can do -
This is blazing fast!
In IDEs
In most IDEs or advanced editors you should be able to simply control click or right click and select "go to definition" to navigate to a function's definition.
I can attest that this works in Netbeans, Eclipse, Komodo, Emacs etc.
If you are open to adopting a new IDE, I suggest Netbeans. It's PHP mode is full of goodies including improved navigation. For example, to quickly open a file you can simply do Alt-Shift-O and type the filename.
首先,我认为您需要了解一些有关 Zend Framework 的知识,它的 MVC 框架如何工作以及模型、视图和控制器的存储位置。这将帮助您猜测到哪里寻找问题。
在搜索特定代码行或模式方面,大多数操作系统或 IDE 将允许您对一组文件执行递归搜索。我认为这超出了本网站的范围。
First of all I think you'll need to learn a bit about Zend Framework, how it's MVC framework works and where the models, views and controllers are stored. This'll help you guess where to go looking for problems.
In terms of searching for specific lines of code or patterns most operating systems or IDEs will allow you perform a recursive search of a set of files. I think that's outside the scope of this site.
如果您使用 aptana,您可以通过搜索 -> 搜索来搜索整个工作区。如果您使用的是 Dreamweaver,您可以打开查找菜单并搜索当前站点
if you are using aptana you can search your whole workspace by going to search->search. If you are using dreamweaver you can open find menu and search through your current site
如果您根本不了解该应用程序,则很难快速找到正确的文件。我建议阅读 Zend Framework 及其工作原理。
如果您需要显示回溯,debug_backtrace() 可以派上用场。如果您需要知道函数是从哪里被调用的,这会很有用。
如果您正在搜索输出某些内容的文件,简单的“搜索所有目录,递归”搜索可能就可以了。大多数 IDE(甚至像 Notepad++ 这样的“简单”IDE)甚至操作系统都内置了此功能。
It will be pretty hard to locate the right file in a quick way if you don't have any knowledge about the application at all. I would recommend reading up on Zend Framework and how it's working.
debug_backtrace() can come in handy if you need to show a backtrace. This can be useful if you need to know from where a function has been called.
If you're searching for a file that outputs something, a simple "search all directories, recursive" search will probably do just fine. Most IDEs (even "simple" one like Notepad++) or even OSes have this built in.