0
내가 텍스트가이 같은 키워드 뭔가에 관련 단어를 강조하고자 '과정'버튼을 눌러 강조 작업. 어떤 육체적 도움? 고맙습니다 !검색 및 멀티 키워드
내가 텍스트가이 같은 키워드 뭔가에 관련 단어를 강조하고자 '과정'버튼을 눌러 강조 작업. 어떤 육체적 도움? 고맙습니다 !검색 및 멀티 키워드
당신이
<?php
$str="Hello World You are on StackOverflow";// Your large text
$arrMatchWords=array("World","on");// Provide all your matching text.
foreach($arrMatchWords as $k=>$v)
{
$str=str_replace($v,"<span style='background:#ffff00'>".$v."</span>",$str);
}
echo ($str);
OUTPUT처럼 뭔가를 할 수 있습니다
$keywords = array("computers" => NULL,"paper" => NULL, "rocket" => NULL);
$text = preg_split('/\s/', $my_text_string);
foreach($text as $key => $value)
{
if(array_key_exists($value, $keywords)) {
echo $value . "\n";
$text[$key] = '<span style="background:yellow">'. $value . '</span>';
}
}
$my_text_string = implode(' ', $text);
echo $my_text_string;
?>