Home >Backend Development >PHP Tutorial >javascript - 最小代码实现WIKI的内链接

javascript - 最小代码实现WIKI的内链接

WBOY
WBOYOriginal
2016-06-06 20:38:471008browse

不管用什么语言用最少的代码实现WIKI的内链接~

回复内容:

不管用什么语言用最少的代码实现WIKI的内链接~

就是一个正则吧

比如

<code>js</code><code>"这是一些wiki代码,参考[[帮助]]".replace(/\[\[([^\[\]]+)\]\]/g, '<a href="/wiki/%241">$1</a>')
"这是一些wiki代码,参考<a href="/wiki/%E5%B8%AE%E5%8A%A9">帮助</a>"
</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php的nullNext article:spl_autoload_register 参数问题