最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php在字符串中查找另一個字符串

 更新時間:2008年11月19日 00:03:03   作者:  
在php下實現(xiàn)從指定的字符串中搜索字符串
<a href="./">返回列表</a><br>
<form action="<?echo $PHP_SELF;?>" method="post">
在<input type="text" name="string" value="<?echo $string;?>">中查找<input type="text" name="query" value="<?echo $query;?>"><br>
<input type="radio" name="where" value="" <?if(!isset($where) or $where=="") echo "checked";?>>第二個字符串可以在第一個字符串的任何位置<br>
<input type="radio" name="where" value="^" <?if(isset($where) and $where=="^") echo "checked";?>>第一個字符串以第二個字符串開始<br>
<input type="radio" name="where" value="$" <?if(isset($where) and $where=="$") echo "checked";?>>第一個字符串以第二個字符串結(jié)束<br>
<input type="checkbox" name="case" value="case" <?if(isset($case)) echo "checked";?>>區(qū)分大小寫<br>
<input type="submit" value="查詢">
</form>
<?
if(isset($string) and isset($query) and $string<>"" and $query<>""){
  if(isset($case)){
    $func = "ereg";
  }
  else{
    $func = "eregi";
  }
  switch($where){
    case "^":
      $query = "^" . $query;
      break;
    case "$":
      $query .= "$";
      break;
  }
  eval("$found = $func("$query","$string");");
  if($found){
    echo "找到!";
  }
  else{
    echo "未找到!";
  }
}
?>
</body>

相關(guān)文章

最新評論

舒城县| 清水县| 尚义县| 普宁市| 永宁县| 阜康市| 内江市| 曲松县| 富川| 海南省| 新田县| 珲春市| 抚顺市| 白朗县| 元朗区| 诸城市| 红原县| 靖西县| 光山县| 邵阳县| 湄潭县| 花莲市| 若羌县| 潼南县| 百色市| 柳州市| 湟源县| 安国市| 抚远县| 广德县| 庆安县| 姜堰市| 沙河市| 图木舒克市| 宁乡县| 义乌市| 扬州市| 明水县| 舞阳县| 满城县| 瓦房店市|