正则裁切文件 php 数组 JS
有一个需求,读取一个文件抓取文件中的JS数组。贴出你文件中的数据看看
截掉了部分,要不发不了
var switchPara = new Array(26,0,1,24,25,2,6,8,2,2,4);
var VlanTagGlobalList = new Array(
0, 1, 1,
0, 1, 1,
0, 1, 1,
0, 1, 1,
0, 1, 1,
0, 1, 1,
0, 1, 1,
0, 1, 1,
0, 1, 1,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 1,
0, 1, 0,
0, 0, 99,
0, 0, 99,
0,0 );
var VlanTagGlobalTList = new Array(
0, 99,
0, 99,
0, 99,
0, 99,
0, 99,
0, 99,
0,0 );
var userLevel=window.parent.user[1];
//-->bedae1ad67868425befe4a2056d27ff6
6c04bd5ca3fcae76e30b72ad730ca86dbacbf9e1ad7f40415ce1670e31edfee3
a9463da6a4d715839f9be19a136dea60
61ca50877680032a8fb127444ae301e5
a34de1251f0d9fe1e645927f19a896e831bff50dc5d62091405569d66bc66752Tag VLAN全局配置b90dd5946f0946207856a8a37f441edffd273fcf5bcad3dfdad3c41bd81ad3e5
f16b1740fad44fb09bfe928bcc527e08
753c122c53ac0bcbbf56642fb95d1d23
f70d0ebff76a19226909a4a79919b5e8d22e5229a386b03ee6104b5d2e79ad26cf6d1f2fd7e053e1ff226b04ef765d70
f70d0ebff76a19226909a4a79919b5e89a8e09710992754b2c624b559648584ea5224fecefb3dc93307c75db52150b1e
bb1fc647f713cf5bd21ef3cc37d3cff6 b6c5a531a458a2e790c1fd6421739d1c端口b90dd5946f0946207856a8a37f441edfb6c5a531a458a2e790c1fd6421739d1c缺省VIDb90dd5946f0946207856a8a37f441edfb6c5a531a458a2e790c1fd6421739d1cUntag帧处理 b90dd5946f0946207856a8a37f441edfb6c5a531a458a2e790c1fd6421739d1c端口b90dd5946f0946207856a8a37f441edfb6c5a531a458a2e790c1fd6421739d1c缺省VIDb90dd5946f0946207856a8a37f441edfb6c5a531a458a2e790c1fd6421739d1cUntag帧处理 b90dd5946f0946207856a8a37f441edffd273fcf5bcad3dfdad3c41bd81ad3e5
c9b2223153d8e39163b0aa064e06fe9ebedae1ad67868425befe4a2056d27ff6
f5a47148e367a6035fd7a2faa965022eadca8a5fa06ffeafb062c2e3f274b93036cc49f0c466276486e50c850b7e495693f0f5c25f18dab9d176bd4f6de5d30e0a38f0830a55e802afea8a264e09be309c3bca370b5104690d9ef395f2c5f8d173a6ac4ed44ffec12cee46588e518a5e
c9b2223153d8e39163b0aa064e06fe9e708689ba0d8b36b6eee3b085345c9d7ebedae1ad67868425befe4a2056d27ff6
a99346057ee270e8e6ad4b11925728138e4efd63b455899fe3bee7f17ed5cd6f2cacc6d41bbb37262a98f745aa00fbf0
$s=你的串preg_match_all('/Array\(.+\)/sU',$s,$m);print_r($m);
$s =<<< TXTvar switchPara = new Array(26,0,1,24,25,2,6,8,2,2,4);var VlanTagGlobalList = new Array(0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 99, 0, 0, 99, 0,0 );var VlanTagGlobalTList = new Array(0, 99, 0, 99, 0, 99, 0, 99, 0, 99, 0, 99, 0,0 );var userLevel=window.parent.user[1];//--></Script>TXT;preg_match_all('/new Array\((.+?)\)/s', $s, $r);print_r($r[1]);Array
谢谢,十分的感谢。
还是自己的基本不扎实,我还一直以为没有这类函数呢。
看到preg_match_all 仅看到了返回值是int 我就直接放弃看它了。。。
再次感谢