thinkphp keyword highlighting
First define a function in function.php:
//关键字描红 function keywords_red($string,$keywords=''){ if(empty($keywords)||empty($string)) return $string; return str_replace($keywords,'<span class="red">'.$keywords.'</span>',$string); }
Then write this in the template variable
{$<pre name="code" class="php">/* **参数说明 **$sheng为页面输出的变量 **$keywords_red即是描红函数 **###代表第一个参数,即$sheng **$q代表需要描红的字体,即搜索的关键字 */
sheng|keywords_red=###,$q}
The above introduces thinkphp keyword tracing, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The problem of using RedisStream to implement message queues in Go language is using Go language and Redis...

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

How to achieve the effect of small labels in the design draft on the mobile terminal? When designing mobile applications, it is common to find out how to accurately restore the small label effect in the design draft...

When adding shadows to text gradients, the solution to the grandfather background blocks pseudo-elements. When adding shadows to text gradients, pseudo-elements and absolute positioning are usually used to...

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

In-depth discussion of the differences in console.log output in this article will analyze the reasons why the output results of console.log function in a piece of code are different. Code snippets involve URL parameter resolution...

About VueMaterialYear...
