清理 PHP/HTML 页面

发布于 2024-07-23 11:05:52 字数 118 浏览 6 评论 0原文

有人知道有什么好用的工具可以清理php和html文件吗? 我以前使用过 Tidy,但它在单独处理 php 代码方面效果不佳。 我知道 tidy 有多种实现,但是有没有专门针对 html 和 php 页面的工具统治冠军?

Does anybody know of a good tool that cleans up files with php and html in it? I've used Tidy before but it doesn't do a good job at leaving the php code alone. I know there are various implementations of tidy but does any tool reign champion specifically for pages with html and php?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

飘过的浮云 2024-07-30 11:05:52

清理代码从将 PHP 与 HTML 分离开始!

Cleaning your code starts with separating PHP from HTML !

耀眼的星火 2024-07-30 11:05:52

我知道这是一个很老的问题,但仍然是一个有效的问题。 我目前使用这个,它似乎做得不错: PHP Formatter

对于HTML、CSS 和 JS,DirtyMarkup 是一个方便的工具。 这些唯一的缺点是您必须复制并粘贴代码两次。

I am aware that this is a pretty old question but still a valid one. I currently use this and it seems to be doing a decent job: PHP Formatter

For HTML, CSS and JS, DirtyMarkup is a handy tool. Only drawback of these is that you have to copy and paste the code twice.

救赎№ 2024-07-30 11:05:52

据我所知,Tidy 是清理 html 代码方面的“卫冕冠军”。 我个人在清理代码时使用过的唯一其他工具是 Adob​​e Dreamweaver。

As far as I know, Tidy is the "reigning champion" when is comes to cleaning html code. The only other tool I've personally used in cleaning code is within Adobe Dreamweaver.

甜心小果奶 2024-07-30 11:05:52

我同意将 HTML 和 PHP 代码分开。 然而,我认为你必须向后思考。 我会将 HTML 代码与 PHP 代码分开。 获取您的 HTML 并阻止它并使用 include 'html_code_1.php';。 因此,您可以在 HTML 上运行 Tidy,而不必担心它会影响您的 PHP 代码。

I would agree with seperating your HTML and your PHP code. However, I think you have to think of it kind of backwards. I would seperate your HTML code from your PHP code. Take your HTML and block it up and use include 'html_code_1.php';. Thus you can run Tidy on your HTML and not worry about it affecting your PHP code.

笔芯 2024-07-30 11:05:52

我以前遇到过这个问题,但是其他程序在重新组织我编码的内容时遇到了问题,并且尝试清理它通常最终弊大于利。 为了解决这个问题,我开始学习 Code Igniter 的详细信息,这是一个基本的 PHP 框架,它使用分离 HTML 和 PHP 的 MVC 方法。 我没有进行太多测试,但它看起来比直接将 HTML 和 PHP 写入单个文件要麻烦得多。

I previously had this problem, however had issues with other programs reorganizing what I coded, and trying to clean it up usually ended up doing more harm than good. To solve this, I am starting to learn the ins and outs of Code Igniter, a basic PHP framework that uses the MVC approach to splitting HTML and PHP. I haven't tested much, but it looks like much less hassle than writing HTML and PHP straight into the single file.

谁与争疯 2024-07-30 11:05:52

如果您无法安装“Tidy”模块(有时当您购买主机时则无法安装),您可以使用这个 PHP 类。

http://www.barattalo.it/html-fixer/

You can use this PHP class, if you can't install the "Tidy" module (sometimes when you buy hosts you can't).

http://www.barattalo.it/html-fixer/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文