如何在您的网站上创建代码突出显示的块 [英] How to creating code highlighted blocks on your website
本文介绍了如何在您的网站上创建代码突出显示的块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写了一个小的PHP框架,我想做一个网站,我解释一些基本的功能。
I have written a small PHP framework and I want to make a website where I explain some basic features.
我想显示的php代码块。有很容易做到这一点,最好没有JavaScript。
I want to display blocks of php code. Is there an easy to do this, preferably without JavaScript.
我想要类似下面显示的部分:
I want to have section kind of like displayed below:
// This function takes in a value and return it
public function getname($name){
return $name;
}
推荐答案
是已经有几个选项:
- The built-in
highlight_file
andhighlight_string
- Highlight source code in your PHP application
- GeSHi - Generic Syntax Highlighter
- CHIP: Code Highlighting in PHP
还有其他的,但只是让你知道有图书馆可用。
There are others, but just letting you know there are libraries available.
这篇关于如何在您的网站上创建代码突出显示的块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文