我正在构建标记系统。从一个阵列到另一个阵列的交叉引用标记系统
我希望它检查一些文本。 然后检查文本是否包含数组中列出的任何术语。 如果它输出的是另一个数组中列出的相应文本? (不知道这是应该做)
到目前为止..
<?php
$information = "This is the sentence that will be checked 123 hello world happy";
$check = array('hello','1','234','andy','happy', 'good mood');
$name = array ('bonjour','one','twothreefour','andrew','happy','happy');
foreach ($check as $value)
if (preg_match("/".$value."/i",$information)) {
$output = "<a href='/search/result/?q=".$value."'>".$name."</a>";
print $output. " ";
}
?>
它在声明中说$ name是我希望它输出的对应词。我做这种方式的原因是因为会有,我想作为一个单一的输出类似短语的一些变化......
如
“快乐”,“愉快的”,“好心情”将所有输出作为‘快乐’
完美谢谢 – AJFMEDIA 2011-02-15 09:27:39