【发布时间】:2014-11-30 14:38:39
【问题描述】:
我有:
$keyword = 'blue';
我想在系统找到blue的字符串中插入一个特殊的类。
例如:
This sky is <span class="blue">blue</a>.
This pear is green.
其实我有:
$string = "The sky is blue.";
if (stripos($string, $keyword) !== false) {
// The string is found, now change the class
}
非常感谢。
【问题讨论】:
-
您是否考虑过改用javascript?
-
我更喜欢在对 PHP 页面进行 ajax 调用时使用 PHP。