2012-03-05 77 views

回答

2

退房的文档的功能strstr
或者strpos
或者preg_match

+0

会有帮助我很感激。我无法理解它是如何工作的... – 2012-03-05 22:41:35

+0

'strpos(“blablab/wp-forum.php?link”,“blablab/wp-forum.php”)' – Julien 2012-03-05 22:45:32

0

您可以使用strpos找到这样的字符串中第一次出现

 <?php 
     $pos = strpos($largerString,$fimdMe); 
     if($pos === false) { 
     // string $findMe not found in $largerString 
     } 
    else { 
     // found it 
    } 
    ?> 
1
$str = "blablab/wp-forum.php?link"; 
$find = "blablab/wp-forum.php"; 

$position = strpos($str, $find); 

if($position !== FALSE) // !== operator to check the type as well. As, strpos returns 0, if found in first position 
{ 
    echo "String contains searched string"; 
} 
相关问题