📜  从文本文件 php 代码示例中获取值

📅  最后修改于: 2022-03-11 14:54:41.932000             🧑  作者: Mango

代码示例1
$lines_array = file("file.txt");
$search_string = "bing";

foreach($lines_array as $line) {
    if(strpos($line, $search_string) !== false) {
        list(, $new_str) = explode(":", $line);
        // If you don't want the space before the word bong, uncomment the following line.
        //$new_str = trim($new_str);
    }
}

echo $new_str;

?>