查看 PHP、Javascript 和 HTML 的源代码?
我有一个包含 javascript、php 和 html 的 .php 文件。我想包含一个按钮/链接来查看整个文件“打印得很漂亮”的源代码,但我似乎无法完成任何工作。最好的方法是什么?
I've got a .php file with javascript, php, and html. I want to include a button/link to view the source of the entire file "pretty printed", but I can't seem to get anything to work. What is the best way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
配置 Apache/PHP 的某些组合后,以
.phps
结尾的文件不会作为 PHP 运行,而是会突出显示并进行美化。示例:
Some combinations of Apache/PHP are configured so that files ending in
.phps
aren't run as PHP, but instead, highlighted and prettified.Example:
如果您只想显示文件的代码,您可以调用此函数:
因此,如果您想显示 myPhpFile.php,只需执行
至其美化,请按照注释的链接进行操作。
If you simply want to display the code of the file, you can call this function:
So, if you want to display myPhpFile.php, just do
As far as making it prettified, follow the link that was commented.