我从网页一样获取数据...制作一条线(包含“”)一个数组。
1554.65 Â 60.15 Â 4.02%
1557.30 Â 61.15 Â 4.09%
现在我需要从第二行获取值“1557.30”,“61.16”和“4.19%”。
怎样才能让第二个像一个数组?
我从网页一样获取数据...制作一条线(包含“”)一个数组。
1554.65 Â 60.15 Â 4.02%
1557.30 Â 61.15 Â 4.09%
现在我需要从第二行获取值“1557.30”,“61.16”和“4.19%”。
怎样才能让第二个像一个数组?
// $str contains the string you mentioned.
$lines = explode('\n', $str);
$values = explode('Â', $lines[1]); // second line (0-based index).
$values
然后将三个元件的阵列。
$ values = explode('',$ lines [1]);剂量不显示任何东西......但是$ values = explode('','1557.30 61.15±4.09%“);作品... –
尝试这种情况:
$txt = "1554.65 Â 60.15 Â 4.02%";
$keywords = preg_split("/Â/", $txt);
停止放
array (size=3)
0 => string '1554.65 ' (length=8)
1 => string ' 60.15 ' (length=7)
2 => string ' 4.02%' (length=6)
'爆炸'成行,然后再次成列。 – AbraCadaver
我并不是100%确定爆炸是否适用于Unicode字符,但它很好:http://sandbox.onlinephpfunctions.com/code/2c7230ce9d2a9a6d45ea90f5b97a329c96cc6437 – DanielM