strpos失败并在循环中打印描述。这可能是原因。对于某些字符串,它正在工作。但这里它不起作用。
$text ="<ul><li>*Compared with the EXR Processor Pro.</li><li>**Equipped with XF27mmF2.8 in High Performance mode.</li><li>***MF mode.</li></ul>";
$description = "The adoption of the dual CPU and improved performance has doubled the processing speed when compared with the previous generation processor*, the start-up time has also improved to only approx. 0.5 sec.** Working in tandem with the high-speed signal readout of the X-Trans CMOS II sensor, the processor reduces the shooting interval to 0.5 sec.*** and shutter time lag to 0.05 sec<br /><ul><li>*Compared with the EXR Processor Pro.</li><li>**Equipped with XF27mmF2.8 in High Performance mode.</li><li>***MF mode.</li>
</ul>";
if($text!="" && strpos($description,$text) === false)
{
echo $description;exit;
}
答案 0 :(得分:0)
您需要删除多余的空格,并与$text
尝试
$description
字符串相同
$text ="<ul><li>*Compared with the EXR Processor Pro.</li><li>**Equipped withXF27mmF2.8 in High Performance mode.</li><li>***MF mode.</li></ul>";
$description = "The adoption of the dual CPU and improved performance has doubled the processing speed when compared with the previous generation processor*, the start-up time has also improved to only approx. 0.5 sec.** Working in tandem with the high-speed signal readout of the X-Trans CMOS II sensor, the processor reduces the shooting interval to 0.5 sec.*** and shutter time lag to 0.05 sec<br /><ul><li>*Compared with the EXR Processor Pro.</li><li>**Equipped withXF27mmF2.8 in High Performance mode.</li><li>***MF mode.</li></ul>";
if($text!="" && strpos($description,$text) === false) {
echo $description;exit;
}
答案 1 :(得分:0)
那是因为前一行之前的新行 所以它不相同
尝试删除新行
$text ="<ul><li>*Compared with the EXR Processor Pro.</li><li>**Equipped with XF27mmF2.8 in High Performance mode.</li><li>***MF mode.</li></ul>";
$description = "The adoption of the dual CPU and improved performance has doubled the processing speed when compared with the previous generation processor*, the start-up time has also improved to only approx. 0.5 sec.** Working in tandem with the high-speed signal readout of the X-Trans CMOS II sensor, the processor reduces the shooting interval to 0.5 sec.*** and shutter time lag to 0.05 sec<br /><ul><li>*Compared with the EXR Processor Pro.</li><li>**Equipped with XF27mmF2.8 in High Performance mode.</li><li>***MF mode.</li>
</ul>";
// remove the new lines
$text = preg_replace('/\n/', '', $text) ;
$description = preg_replace('/\n/', '', $description) ;
if($text!="" && strpos($description,$text) === false)
{
echo $description;exit;
}