After explosion the .txt我有一些数据
array(1) {[0]=>字符串(47)&;Windows产品密钥信息&;}
array(1) {[0]=>字符串(2)";";}
array(2) {[0]=>字符串(12)"产品名称";[1] =比;字符串(17)";Windows 10 Pro "}
array(1) {[0]=>字符串(2)";";}
array(2) {[0]=>字符串(7)"Version"[1] =比;字符串(25)";19041.1165(64位操作系统);}
array(1) {[0]=>字符串(2)";";}
array(2) {[0]=>字符串(10)&;产品id &;[1] =比;字符串(26),00331 - 10000 - 00001 aa555";}
array(1) {[0]=>字符串(2)";";}
和我只是需要的数据在一个变量是粗体字符帮助我在这个问题。
.txt文件类似于
ShowKeyPlus - Windows产品密钥信息
产品名称:Windows 10 Pro
Version: 19041.1165(64位OS)
产品编号:00331-10000-00001-AA741
while(!feof($file)) {
$content = fgets($file);
$carry = explode(":", $content);
if($carry[0] == "Product ID")
{
echo $carry[1];
}
}
Eplaination:你的代码逐行读取它
$进位是数组后的爆炸行":">
如果$carry[0]是"产品ID"然后显示$carry[1]
的值